[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ssh_handle_packets blocking issue
[Thread Prev] | [Thread Next]
- Subject: Re: ssh_handle_packets blocking issue
- From: Mikhail Kulinich <tysonite@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 6 Apr 2011 00:16:13 +0400
- To: libssh@xxxxxxxxxx
- Cc: Aris Adamantiadis <aris@xxxxxxxxxxxx>
Hello Aris, Thanks for your feedback! I will try to test a new libssh 0.5 against this issue. However, it can take a time. As I understand, interfaces were changed very much, and, unfortunately, I have code (already legacy) which needs to be checked and changed. The content is correct and it is a first call to the read_channel. There are no other parallel sessions. I can reproduce this issue 100% with libssh 0.4.4. FYI, along time ago I changed this behavior with the patch for channel_read function: {{{ ... rc = ssh_socket_poll(channel->session->socket, &w, &e); * if (rc == 0) { break; }* if (rc < 0) { /* system poll error */ leave_function(); return -1; } ... somewhere call to packet_read... }}} Note: In the original code you check rc only for < 0. FYI2, I do not rely on ssh_select for polling fds. I use my own implementation for events handling and transfer only fd between my code and libssh. May be this information can help... 2011/4/5 Aris Adamantiadis <aris@xxxxxxxxxxxx> > Hi Mikhail, > > Does your problem still happen with 0.5 ? The network code was pretty > much rewritten, and I think that bug should have disappeard together > with the synchronous system. > > I'll check again, because it may be something completely different now > that I read it. was this channel_read the *first* channel_read on the > channel ? Do the content of the buffer you're dumping the correct > content of your channel ? is it possible that it's some garbage or > similar content of another session/channel ? > > If content is correct and buffer->used is null, there's indeed a problem. > > Thanks, > > Aris > Le 5/04/11 21:46, Mikhail Kulinich a écrit : > > Hello, > > > > It seems that guys meet an issue which I am observing for a year or more. > > During migration to new bug tracker, that original issue (created by me) > > was missed. > > The latest info I sent to the mailing list concerning it: > > {{{ > > #2 0x080e4138 in ssh_socket_unbuffered_read (s=0x8ca3eb0, > > buffer=0x8c9e1c8, len=16) > > at /home/shamanin/libssh_lin/ > > libssh-0.4.4/libssh/socket.c:200 > > 200 rc = recv(s->fd,buffer, len, 0); > > Current language: auto; currently c > > (gdb) up > > #3 0x080e430b in ssh_socket_completeread (s=0x8ca3eb0, > > buffer=0x8c9e1c8, len=16) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/socket.c:275 > > 275 while((r = ssh_socket_unbuffered_read(s, ((uint8_t*)buffer + > > total), toread))) { > > > > > > (gdb) bt > > #0 0xb776e424 in __kernel_vsyscall () > > #1 0xb770a428 in recv () from /lib/tls/i686/cmov/libpthread.so.0 > > #2 0x080e4138 in ssh_socket_unbuffered_read (s=0x8ca3eb0, > > buffer=0x8c9e1c8, len=16) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/socket.c:200 > > #3 0x080e430b in ssh_socket_completeread (s=0x8ca3eb0, > > buffer=0x8c9e1c8, len=16) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/socket.c:275 > > #4 0x080e4985 in ssh_socket_wait_for_data (s=0x8ca3eb0, > > session=0x8ca4c58, len=16) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/socket.c:405 > > #5 0x080e1e54 in packet_read2 (session=0x8ca4c58) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/packet.c:94 > > #6 0x080e2429 in packet_read (session=0x8ca4c58) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/packet.c:401 > > #7 0x080cdd56 in channel_read (channel=0x8ca9720, dest=0x8cad460, > > count=1, is_stderr=0) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/channels.c:1916 > > #8 0x0809958b in maux::SshDescriptor::read (this=0x8ca46d8, > > cpBuf=0x8cad460 "", iBufLen=1, > > iFlag=0) at ../SshDescriptor.cc:415 > > #9 0x08053e57 in autotest::SshAccess::_receive (this=0x8ca46d8, > > buffer=@0xb32b10a8) > > at ../SshAccess.cc:177 > > #10 0x080543ed in autotest::SshAccess::onActivity (this=0x8ca46d8, > > pWaiter=0x8ca4298, iFlags=1) > > at ../SshAccess.cc:300 > > #11 0x08092fd3 in maux::Waiter::onActivity (this=0x8ca4298, > > pxDescr=0x8ca46d8, iFlags=1) > > at ../Waiter.cc:915 > > #12 0x08093b7d in maux::Waiter::dispatchOneEvent (this=0x8ca4298) at > > ../Waiter.cc:692 > > #13 0x08094992 in maux::Waiter::doMainLoop (this=0x8ca4298) at > > ../Waiter.cc:506 > > #14 0x08096f04 in maux::OwnThread<maux::Waiter>::main (this=0x8ca42f4) > > at ../Thread.hh:183 > > #15 0x08091afc in maux::mainThreadFunction (pxThreadStartup=0xb63f972c) > > at ../Thread.cc:40 > > #16 0xb770350f in start_thread () from /lib/tls/i686/cmov/libpthread.so.0 > > #17 0xb74f07ee in clone () from /lib/tls/i686/cmov/libc.so.6 > > (gdb) up > > #4 0x080e4985 in ssh_socket_wait_for_data (s=0x8ca3eb0, > > session=0x8ca4c58, len=16) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/socket.c:405 > > 405 r = ssh_socket_completeread(session->socket,buf,to_read); > > (gdb) up > > #5 0x080e1e54 in packet_read2 (session=0x8ca4c58) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/packet.c:94 > > 94 rc = ssh_socket_wait_for_data(session->socket, session, > > blocksize); > > (gdb) up > > #6 0x080e2429 in packet_read (session=0x8ca4c58) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/packet.c:401 > > 401 return packet_read2(session); > > (gdb) up > > #7 0x080cdd56 in channel_read (channel=0x8ca9720, dest=0x8cad460, > > count=1, is_stderr=0) > > at /home/shamanin/libssh_lin/libssh-0.4.4/libssh/channels.c:1916 > > 1916 if ((packet_read(session)) != SSH_OK || > > (gdb) print channel->stdout_buffer > > $1 = (ssh_buffer) 0x8ca8640 > > (gdb) print channel->stdout_buffer->used > > $2 = 0 > > (gdb) print *channel->stdout_buffer > > $3 = { > > data = 0x8cacc58 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<hello > > > xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n<capabilities>\n<capability>urn:ietf:params:netconf:base:1.0</capability>\n<capability>urn:ietf:params:netc"..., > > used = 0, allocated = 2048, pos = 0} > > > > }}} > > > > If you need more details I'll try to get them. > > > > 2011/4/5 Aris Adamantiadis <aris@xxxxxxxxxxxx <mailto:aris@xxxxxxxxxxxx > >> > > > > Jeetu, > > > > I read your email in details and still am not sure it's correlated > with > > Sharon's problem. > > Could you provide me a backtrace (with full symbols if possible) of a > > stuck process (with the -1 timeout) so I can have an idea of what > > condition it's waiting for and why it doesn't arrive. > > > > A verbose log (with ssh_options_set) of the same session would > greatly > > help, along with the code snippet you're using to handle ssh > connexions. > > > > Thanks, > > > > Aris > > > > Le 5/04/11 14:20, jeetu.golani@xxxxxxxxx > > <mailto:jeetu.golani@xxxxxxxxx> a écrit : > > > Hi, > > > > > >> Hello Jeetu, Sharon, > > > > > >> I'll look at that issue asap. It's a blocking problem for release > > 0.5. > > > > > >> Aris > > > > > > Aris, Thanks so much :) Please let me know if you need me to try > > something > > > or any further data to help you debug this. > > > > > >> If this is on Windows, which Windows version are you running? We > > have a > > >> poll(2)-emulation for older Windows versions. This version > > doesn't set > > >> POLLERR, maybe that's causing the problem. > > >> > > > > > > Andreas, I'm seeing this behaviour on Linux (debian testing). > > Please let > > > me know if you need any further info to debug this or if I can > > help in any way. > > > > > > Thanks so much yet again for a very nice piece of work :) > > > > > > Bye for now > > > Jeetu > > > > > > ebrain.in <http://ebrain.in> | Beehive Computing > > > Discover and run software from any device around you. > > > > > > > > > > > > > -- > > Mikhail > > > > -- Mikhail
Re: ssh_handle_packets blocking issue | "jeetu.golani@xxxxxxxxx" <jeetu.golani@xxxxxxxxx> |
Re: ssh_handle_packets blocking issue | "Sharon Heath" <Sharon.Heath@xxxxxxxxxxxxxxxxxxxxxx> |
Re: ssh_handle_packets blocking issue | "jeetu.golani@xxxxxxxxx" <jeetu.golani@xxxxxxxxx> |
Re: ssh_handle_packets blocking issue | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
Re: ssh_handle_packets blocking issue | "jeetu.golani@xxxxxxxxx" <jeetu.golani@xxxxxxxxx> |
Re: ssh_handle_packets blocking issue | Aris Adamantiadis <aris@xxxxxxxxxxxx> |
Re: ssh_handle_packets blocking issue | Mikhail Kulinich <tysonite@xxxxxxxxx> |
Re: ssh_handle_packets blocking issue | Aris Adamantiadis <aris@xxxxxxxxxxxx> |