Bug 1005686

Summary: Long delay when FTP connection is interrupted from CURLOPT_HEADERFUNCTION callback
Product: [Fedora] Fedora Reporter: Tomas Mlcoch <tmlcoch>
Component: curlAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: kdudka, paul
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: curl-7.32.0-2.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-12 02:06:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Reproducer (Use flags "-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -lglib-2.0 -lcurl") none

Description Tomas Mlcoch 2013-09-09 07:38:48 UTC
Created attachment 795521 [details]
Reproducer (Use flags "-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -lglib-2.0 -lcurl")

Description of problem:

I am using CURLOPT_HEADERFUNCTION for parsing FTP return codes (messages) while downloading via FTP.
I am specially interested in FTP code 213 which returns size of a downloaded file. Sometimes I know expected size and when this size differ from size that server reports (via the 213 code), then I want to interrupt this download.

The download interruption is done by returning a bad return value from the CURLOPT_HEADERFUNCTION callback. But I've met the problem, that after a bad return value is returned, the CURL hangs for about 60sec (just my estimation, I didn't do exact measurement) before it returns from curl_easy_perform().

My expectation is that curl_easy_perform() return immediately after CURLOPT_HEADERFUNCTION returns the bad return value.

Version-Release number of selected component (if applicable):
curl-7.29.0-9.fc19.x86_64
libcurl-devel-7.29.0-9.fc19.x86_64

How reproducible:
Check the attached reproducer

Actual results:
60sec hang after download is interrupted

Expected results:
no hang

Comment 1 Kamil Dudka 2013-09-09 11:33:05 UTC
upstream commit:

https://github.com/bagder/curl/commit/c639d725

Comment 2 Tomas Mlcoch 2013-09-09 11:56:32 UTC
It works! Thank you!
Do you plan to make a build with this patch for F18 and F19 sometimes, or it will be only rawhide stuff?

Comment 3 Kamil Dudka 2013-09-09 12:29:46 UTC
fixed in curl-7.32.0-2.fc21

Comment 4 Kamil Dudka 2013-09-09 12:31:00 UTC
(In reply to Tomas Mlcoch from comment #2)
> Do you plan to make a build with this patch for F18 and F19 sometimes, or it
> will be only rawhide stuff?

Sure, will submit updates for F18+ shortly.

Comment 6 Fedora Update System 2013-09-09 13:11:52 UTC
curl-7.29.0-11.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/curl-7.29.0-11.fc19

Comment 7 Fedora Update System 2013-09-09 13:12:05 UTC
curl-7.27.0-12.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/curl-7.27.0-12.fc18

Comment 8 Fedora Update System 2013-09-09 13:12:15 UTC
curl-7.32.0-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/curl-7.32.0-2.fc20

Comment 9 Fedora Update System 2013-09-09 16:20:57 UTC
Package curl-7.32.0-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing curl-7.32.0-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-16153/curl-7.32.0-2.fc20
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-09-12 02:06:06 UTC
curl-7.29.0-11.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2013-09-16 00:29:16 UTC
curl-7.27.0-12.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2013-09-23 00:07:22 UTC
curl-7.32.0-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.