Subject: Re: libssh2_sftp_init() blocks and does not return

Re: libssh2_sftp_init() blocks and does not return

From: Keith Maika <keithm_at_aoeex.com>
Date: Wed, 18 Mar 2009 20:12:20 -0400

Daniel Stenberg wrote:
> On Wed, 18 Mar 2009, Heiner Steven wrote:
>
>> Unfortunately it does not work: the program "hangs" in the library
>> call libssh2_sftp_init() and does not return.
>
> Are you using a blocking or non-blocking socket?
>
>> #0 0x00007f6fe65790d5 in recv () from /lib/libc.so.6
>> #1 0x000000000042a62a in _libssh2_packet_read (session=0x16546d0)
>> at transport.c:362
>> #2 0x00000000004116dd in libssh2_channel_read_ex (channel=0x165ca40,
>> stream_id=0, buf=0x7fffef643a10 "–:dÔˇ\177", buflen=4) at
>> channel.c:1515
>>
>> "strace" shows the process blocking in "recvfrom(3, ...".
>>
>> Is this a known problem?
>
> No it isn't, but I'll admit I don't do a lot of tests with blocking
> sockets.
>
>

I get this same problem using the example sftp.c program that is
provided with libssh2. I noticed it when I was first going to check the
changes you were doing for the speed because I was curious about it,
however I have no personal applications that use libssh2 so I just used
your examples. It still occurs with the latest CVS updates.

When I run it, I get the following:
kicken_at_bonzi:~/libssh2/libssh2/example/simple$ ./sftp 192.168.0.3
username password /tmp/TEST
Fingerprint: E5 2C 2C 13 5A AD CC 30 D7 03 31 8A 6E 42 39 14
Authentication methods: publickey,password
libssh2_sftp_init()!
Unable to init SFTP session
all done

After libssh2_sftp_init() is printed, it stalls for a little while, then
continues. Running it in gdb, and using ctrl+c to interrupt when it
calls, brings this backtrace:

(gdb) bt
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7f18421 in recv () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7fac643 in _libssh2_packet_read (session=0x804b008) at
transport.c:362
#3 0xb7f900dc in libssh2_channel_read_ex (channel=0x804fea8,
stream_id=0, buf=0xbfed82d4 "\001", buflen=4) at channel.c:1515
#4 0xb7fa2270 in sftp_packet_read (sftp=0x8050f38) at sftp.c:154
#5 0xb7fa272f in sftp_packet_require (sftp=0x8050f38, packet_type=2
'\002', request_id=0, data=0xbfed8364, data_len=0xbfed8360) at sftp.c:303
#6 0xb7fa32df in libssh2_sftp_init (session=0x804b008) at sftp.c:645
#7 0x08049385 in main (argc=5, argv=0xbfed88c4) at sftp.c:203

-- 
Keith Maika
http://aoeex.com/ - Personal site
http://www.gnu.org/philosophy/can-you-trust.html - Can you trust your 
computer?
http://www.gnu.org/philosophy/no-word-attachments.html - Support Open 
Communication.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-03-19