cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: non-blocking FTP

From: Jeff Weber <jweber_at_amsc.com>
Date: Wed, 14 May 2008 21:01:46 -0500

On Wed, May 14, 2008 at 11:51:29PM +0200, Daniel Stenberg wrote:
> On Wed, 14 May 2008, Jeff Weber wrote:
>
>> I've noticed 2 behaviors. Either the library starts running the progress
>> callback at approximately 1Hz
>
> Did you mention what libcurl version and platform you're using?
libraries: curl-7.18.1, libssh2-0.18,
arch: i686
Linux: 2.4.27
gcc: gcc-3.3.6 (note: code is C++)

>
>> or no callback is invoked at all. I wait for 3 minutes. I use raw dotted
>> quad IP addresses, not DNS names.
>
> Then you're seeing a bug. Can you repeat it? Can you check out what it is
> doing during that time?

If I start the test with no network connection, [and not using DNS names], it
hangs every time. Here's a backtrace of the hung thread:

(gdb) thread 3
[Switching to thread 3 (Thread 16386 (LWP 6805))]#0 0x4024e2da in poll ()
   from /lib/libc.so.6
(gdb) bt
#0 0x4024e2da in poll () from /lib/libc.so.6
#1 0x0806c037 in Curl_socket_ready (readfd=-1, writefd=6, timeout_ms=299998)
    at select.c:218
#2 0x080643ac in waitconnect (sockfd=6, timeout_msec=299998) at connect.c:260
#3 0x0806509f in singleipconnect (conn=0x81696cc, ai=0x816c124,
    timeout_ms=299998, connected=0xbf7ffa0b) at connect.c:817
#4 0x080652e4 in Curl_connecthost (conn=0x81696cc, remotehost=0x816c1bc,
    sockconn=0x816976c, addr=0xbf7ff9e0, connected=0xbf7ffa0b) at connect.c:918
#5 0x0805768d in ConnectPlease (data=0x815e024, conn=0x81696cc,
    hostaddr=0x816c1bc, connected=0xbf7ffa0b) at url.c:2637
#6 0x08059e93 in SetupConnection (conn=0x81696cc, hostaddr=0x816c1bc,
    protocol_done=0xbf7ffa52) at url.c:4278
#7 0x08059fe0 in Curl_connect (data=0x815e024, in_connect=0xbf7ffa8c,
    asyncp=0xbf7ffa53, protocol_done=0xbf7ffa52) at url.c:4355
#8 0x080634d7 in connect_host (data=0x815e024, conn=0xbf7ffa8c)
    at transfer.c:2275
#9 0x08063656 in Curl_perform (data=0x815e024) at transfer.c:2354
#10 0x0804e399 in curl_easy_perform (curl=0x815e024) at easy.c:509
#11 0x0804c4b9 in AMSC::CFileXferImple::blockingUpload (opaque=0x8152f90)
    at amscfilexfer.cpp:441
#12 0x401554eb in pthread_start_thread () from /lib/libpthread.so.0
#13 0x40256b0a in clone () from /lib/libc.so.6
(gdb) frame 1
#1 0x0806c037 in Curl_socket_ready (readfd=-1, writefd=6, timeout_ms=299998)
    at select.c:218
218 r = poll(pfd, num, pending_ms);
Current language: auto; currently c
(gdb) print pending_ms
$1 = 299998

When I break the network connection randomly during the uplink of N files, it
hangs about 1/3 the time. Every backtrace looks the same:

(gdb) thread 2
[Switching to thread 2 (Thread 32769 (LWP 6561))]#0 0x4024e2da in poll ()
   from /lib/libc.so.6
(gdb) bt
#0 0x4024e2da in poll () from /lib/libc.so.6
#1 0x40154990 in __pthread_manager () from /lib/libpthread.so.0
#2 0x40256b0a in clone () from /lib/libc.so.6

[Switching to thread 3 (Thread 524290 (LWP 6595))]#0 0x4024e2da in poll ()
   from /lib/libc.so.6
(gdb) bt
#0 0x4024e2da in poll () from /lib/libc.so.6
#1 0x0806c037 in Curl_socket_ready (readfd=6, writefd=-1, timeout_ms=3600000)
    at select.c:218
#2 0x0807f090 in ftp_easy_statemach (conn=0x81696cc) at ftp.c:2971
#3 0x0807fdae in ftp_nextconnect (conn=0x81696cc) at ftp.c:3515
#4 0x08080a38 in ftp_dophase_done (conn=0x81696cc, connected=true)
    at ftp.c:4015
#5 0x08080be2 in ftp_regular_transfer (conn=0x81696cc,
    dophase_done=0xbf7ffa86) at ftp.c:4090
#6 0x0807ff4f in ftp_do (conn=0x81696cc, done=0xbf7ffa86) at ftp.c:3608
#7 0x0805a47b in Curl_do (connp=0xbf7ffa8c, done=0xbf7ffa86) at url.c:4566
#8 0x080636a7 in Curl_perform (data=0x815e024) at transfer.c:2364
#9 0x0804e399 in curl_easy_perform (curl=0x815e024) at easy.c:509
#10 0x0804c4b9 in AMSC::CFileXferImple::blockingUpload (opaque=0x8152f90)
    at amscfilexfer.cpp:441
#11 0x401554eb in pthread_start_thread () from /lib/libpthread.so.0

(gdb) frame 1
#1 0x0806c037 in Curl_socket_ready (readfd=6, writefd=-1, timeout_ms=3600000)
    at select.c:218
218 r = poll(pfd, num, pending_ms);
Current language: auto; currently c
(gdb) print pending_ms
$1 = 3600000
(gdb) print num
$2 = 1

    Jeff
Received on 2008-05-15