cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: FTP Upload problems with Multi interface

From: Andreas Wurf <awurf_at_adobe.com>
Date: Tue, 11 Nov 2008 09:32:45 +0000

Hi Daniel,

I managed again to get the hang against our original test server (Ubuntu / ProFTPD).

You are right, the main loop ("while( result )...") is running during the hang. curl_multi_perform() sets running_handles to 1. curl_multi_fdset() sets fdRead.fd_count = 1, fdWrite and fdException are left cleared. The following call to select() returns 0, clearing fdRead, fdWrite and fdException.

I enclosed a dump of the hanging easy handle's Curl_one_easy struct with expanded easy_handle and easy_conn members:

------------------------------------<snip>------------------------------------
easy 0x00b751c0 {next=0x00b1309c prev=0x00b1309c easy_handle=0x00b63730 ...} Curl_one_easy *
+ next 0x00b1309c {next=0x00b751c0 prev=0x00b751c0 easy_handle=0x00000000 ...} Curl_one_easy *
+ prev 0x00b1309c {next=0x00b751c0 prev=0x00b751c0 easy_handle=0x00000000 ...} Curl_one_easy *
- easy_handle 0x00b63730 {dns={...} multi=0x00b13098 multi_pos=0x00b751c0 ...} SessionHandle *
+ dns {hostcache=0x00b15fc0 hostcachetype=HCACHE_MULTI } Names
+ multi 0x00b13098 {type=764702 easy={...} num_easy=1 ...} Curl_multi *
+ multi_pos 0x00b751c0 {next=0x00b1309c prev=0x00b1309c easy_handle=0x00b63730 ...} Curl_one_easy *
+ share 0x00000000 {specifier=??? dirty=??? lockfunc=??? ...} Curl_share *
+ req {size=-1 bytecountp=0x00000000 maxdownload=-1 ...} SingleRequest
+ set {err=0x10311d40 debugdata=0x00000000 errorbuffer=0x00000000 <Bad Ptr> ...} UserDefined
+ change {url=0x00b76be0 "ftp://foo.bar.com/testfiles/awurf/FtpMultiUpload/file23" url_alloc=0 referer=0x00000000 <Bad Ptr> ...} DynamicStatic
+ cookies 0x00000000 {cookies=??? filename=??? running=??? ...} CookieInfo *
+ progress {lastshow=2057 size_dl=0 size_ul=0 ...} Progress
+ state {used_interface=Curl_if_multi connc=0x00b1ffd8 keeps_speed={...} ...} UrlState
+ info {httpcode=0 httpproxycode=0 httpversion=0 ...} PureInfo
                magic 3235830701 unsigned int
- easy_conn 0x00b75698 {data=0x00b63730 chunk={...} inuse='?' ...} connectdata *
+ data 0x00b63730 {dns={...} multi=0x00b13098 multi_pos=0x00b751c0 ...} SessionHandle *
+ chunk {hexbuffer=0x00b7569c "" hexindex=0 state=CHUNK_FIRST ...} Curl_chunker
                inuse 1 '?' unsigned char
                connectindex 0 long
                protocol 16 long
+ dns_entry 0x00000000 {addr=??? timestamp=??? inuse=??? } Curl_dns_entry *
+ ip_addr 0x00b76e00 {ai_flags=0 ai_family=2 ai_socktype=1 ...} addrinfo *
+ ip_addr_str 0x00b75f58 "1.2.3.4" char *
                scope 0 unsigned int
+ protostr 0x00b756dc "ftp" char [16]
                socktype 1 int
+ host {rawalloc=0x00b75cf0 "foo.bar.com" encalloc=0x00000000 <Bad Ptr> name=0x00b75cf0 "foo.bar.com" ...} hostname
+ proxy {rawalloc=0x00000000 <Bad Ptr> encalloc=0x00000000 <Bad Ptr> name=0x00000000 <Bad Ptr> ...} hostname
                port 21 long
                remote_port 21 unsigned short
+ user 0x00b787c0 "user" char *
+ passwd 0x00b760b8 "password" char *
+ proxyuser 0x00000000 <Bad Ptr> char *
+ proxypasswd 0x00000000 <Bad Ptr> char *
                proxytype CURLPROXY_HTTP curl_proxytype
+ now {tv_sec=2057 tv_usec=625000 } timeval
+ created {tv_sec=2054 tv_usec=984000 } timeval
+ sock 0x00b7573c unsigned int [2]
+ ssl 0x00b75744 {use=0 state=ssl_connection_none ctx=0x00000000 ...} ssl_connect_data [2]
+ ssl_config {version=0 certverifyresult=0 verifypeer=1 ...} ssl_config_data
+ bits {close=0 reuse='?' proxy=0 ...} ConnectBits
+ handler 0x10095758 _Curl_handler_ftp {scheme=0x1009a788 "FTP" setup_connection=0x10045ab0 do_it=0x10044b10 ...} const Curl_handler *
                sockfd 4294967295 unsigned int
                writesockfd 3868 unsigned int
+ allocptr {proxyuserpwd=0x00000000 <Bad Ptr> uagent=0x00000000 <Bad Ptr> accept_encoding=0x00000000 <Bad Ptr> ...} dynamically_allocated_data
                sec_complete 0 int
                readchannel_inuse 0 unsigned char
                writechannel_inuse 0 unsigned char
                server_supports_pipelining 0 unsigned char
+ send_pipe 0x00b75a80 {head=0x00b78070 tail=0x00b78070 dtor=0x10080010 ...} curl_llist *
+ recv_pipe 0x00b75ae0 {head=0x00000000 tail=0x00000000 dtor=0x10080010 ...} curl_llist *
+ pend_pipe 0x00b75b40 {head=0x00000000 tail=0x00000000 dtor=0x10080010 ...} curl_llist *
+ master_buffer 0x00000000 <Bad Ptr> char *
                read_pos 0 unsigned int
                buf_len 0 unsigned int
                seek_func 0x00000000 int (void *, __int64, int)*
                seek_client 0x00000000 void *
                fread_func 0x00412790 CurlReadCallback(void *, unsigned int, unsigned int, void *) unsigned int (char *, unsigned int, unsigned int, void *)*
                fread_in 0x0012f858 void *
+ ntlm {state=NTLMSTATE_NONE flags=0 nonce=0x00b7582c "" } ntlmdata
+ proxyntlm {state=NTLMSTATE_NONE flags=0 nonce=0x00b7583c "" } ntlmdata
+ syserr_buf 0x00b75844 "" char [256]
+ async {hostname=0x00b75ef0 "foo.bar.com" port=21 dns=0x00b77118 ...} Curl_async
+ trailer 0x00000000 <Bad Ptr> char *
                trlMax 0 int
                trlPos 0 int
+ proto {ftpc={...} sshc={...} } <unnamed-tag>
                cselect_bits 0 int
        state CURLM_STATE_DOING CURLMstate
        result CURLE_OK CURLcode
+ msg 0x00000000 {extmsg={...} next=??? } Curl_message *
        msg_num 0 int
+ sockets 0x00b751e0 unsigned int [5]
        numsocks 0 int
------------------------------------</snip>-----------------------------------

Here's the complete WireShark dump of the hanging channel:

------------------------------------<snip>------------------------------------
220 ProFTPD 1.3.0 Server (foo.bar.com) [::ffff:1.2.3.4]
USER user
331 Password required for user.
PASS password
230 User user logged in.
PWD
257 "/" is current directory.
CWD testfiles
250 CWD command successful
CWD awurf
250 CWD command successful
CWD FtpMultiUpload
250 CWD command successful
PASV
227 Entering Passive Mode (1.2.3.4,219,209).
TYPE I
200 Type set to I
STOR file01
150 Opening BINARY mode data connection for file01
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,216,171).
STOR file03
150 Opening BINARY mode data connection for file03
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,243,116).
STOR file04
150 Opening BINARY mode data connection for file04
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,219,34).
STOR file06
150 Opening BINARY mode data connection for file06
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,238,213).
STOR file11
150 Opening BINARY mode data connection for file11
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,247,18).
STOR file12
150 Opening BINARY mode data connection for file12
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,245,52).
STOR file15
150 Opening BINARY mode data connection for file15
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,234,231).
STOR file17
150 Opening BINARY mode data connection for file17
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,207,239).
STOR file18
150 Opening BINARY mode data connection for file18
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,217,227).
STOR file19
150 Opening BINARY mode data connection for file19
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,247,129).
STOR file20
150 Opening BINARY mode data connection for file20
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,244,77).
STOR file21
150 Opening BINARY mode data connection for file21
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,246,176).
STOR file22
150 Opening BINARY mode data connection for file22
PASV // <-- channel stuck here!
------------------------------------</snip>-----------------------------------

And, to be complete, here is the dump of the second channel which runs all to the end (the final 421 reply is received while debugging, a few minutes after the hang occurs).

------------------------------------<snip>------------------------------------
220 ProFTPD 1.3.0 Server (foo.bar.com) [::ffff:1.2.3.4]
USER user
331 Password required for user.
PASS password
230 User user logged in.
PWD
257 "/" is current directory.
CWD testfiles
250 CWD command successful
CWD awurf
250 CWD command successful
CWD FtpMultiUpload
250 CWD command successful
PASV
227 Entering Passive Mode (1.2.3.4,201,165).
TYPE I
200 Type set to I
STOR file02
150 Opening BINARY mode data connection for file02
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,216,171).
STOR file05
150 Opening BINARY mode data connection for file05
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,243,116).
STOR file07
150 Opening BINARY mode data connection for file07
226 Transfer complete.

...etc...

PASV
227 Entering Passive Mode (1.2.3.4,247,53).
STOR file57
150 Opening BINARY mode data connection for file57
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,221,110).
STOR file58
150 Opening BINARY mode data connection for file58
226 Transfer complete.
PASV
227 Entering Passive Mode (1.2.3.4,231,112).
STOR file59
150 Opening BINARY mode data connection for file59
226 Transfer complete.
421 No Transfer Timeout (600 seconds): closing control connection.
------------------------------------</snip>-----------------------------------

I hope this helps.

Regards,
Andreas
Received on 2008-11-11