cURL / Mailing Lists / curl-library / Single Mail

curl-library

long delay or hang in curl_easy_perform without progress callout

From: Eric Nadler <exnadler_at_gmail.com>
Date: Fri, 12 Mar 2010 08:57:40 -0600

I'm seeing something I don't expect from the library and would
appreciate some comments.

I'm using an old version of libcurl, version 7.16.2. I have things
working under most conditions (libcurl has been a blessing!). I just
saw this unexpected situation once.

From the logging I have for my application, it looks like I had just
entered into an FTP curl_easy_perform. My network was disconnected
before I even got my first debug callback with CURLINFO_TEXT which
usually looks something like this:

Re-using existing connection! (#0) with host 10.1.0.253

So I'm assuming I disconnect just at the beginning of
curl_easy_perform before it really got going. My issue is that I
never had my progress function called and the curl_easy_perform "hung"
for minutes. I had set a flag in another thread that would have
caused the progress function to abort the curl_easy_perform if it has
been called. My desire is to have the curl_easy_perform exit out when
I detect the network drop, instead of waiting for it to TCP timeout
(which would presumably take a lot longer).

Are there situations where my progress function will not always be
called every second or so during curl_easy_perform (like if there is a
wait before the transfer really starts)? If so, if I set a
CURLOPT_TIMEOUT and a CURLOPT_FTP_RESPONSE_TIMEOUT will those be
guaranteed to abort the call if it is in that state?

I'm running on an embedded Linux target, kernel 2.6.25 on a PowerPC.
Curl version libcurl/7.16.2 OpenSSL/0.9.8g zlib/1.2.3. I was
uploading to an internal FTP server.

I set these options:
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L)
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L)
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, CurlProgress)
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, this)
curl_easy_setopt(obj.curl, CURLOPT_VERBOSE, 1L)
curl_easy_setopt(obj.curl, CURLOPT_DEBUGFUNCTION, CurlDebug)
curl_easy_setopt(obj.curl, CURLOPT_DEBUGDATA, this_)
curl_easy_setopt(obj.curl, CURLOPT_URL, remoteUrl.c_str())
curl_easy_setopt(obj.curl, CURLOPT_READDATA, source)
curl_easy_setopt(obj.curl, CURLOPT_INFILESIZE, obj.currentXferFileSize)

I saw this fix in the change log in the current version, could this
help me out? I can look into upgrading our libcurl if that will work
better for this situation.
progress meter/callback during FTP connection

Thank you very much!
Eric
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-12