This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 85817 - curl uses 100% CPU on slow connection
curl uses 100% CPU on slow connection
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: curl (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Eido Inoue
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-03-07 23:42 EST by John Reiser
Modified: 2007-04-18 12:51 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-07-01 12:43:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description John Reiser 2003-03-07 23:42:24 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Description of problem:
curl takes all available CPU time, even 100%, when retrieving a long https file
[subscribed rhn Instant ISO] at 60KB/s [DSL to eth0] on a fast CPU [1.6GHz]. 
The performance diagnostics vmstat, top, ps all show that the curl process
consumes all available CPU cycles.  This is an unreasonably large load, which
increases latency and worsens realtime response for multimedia tasks, etc. 
Performing the transfer with wget [from a ftp mirror] requires only 0.3% CPU.

Version-Release number of selected component (if applicable):
curl 7.9.5 (i386-redhat-linux-gnu) libcurl 7.9.5 (OpenSSL 0.9.6b) (ipv6 enabled)
kernel 2.4.18-18.7.x

How reproducible:
Always

Steps to Reproduce:
1. vmstat  &  curl -C - -O '<phoebe-ISO>'  # with 60KB/s transfer rate
2.
3.
    

Actual Results:  Typical CPU usage: 54% usr, 46% sys, 0% idle.

Expected Results:  Typical CPU usage <1% usr, <1% sys, >98% idle.

Additional info:

Here is an excerpt from using strace on curl:
-----
read(3, "n H\26\217\361k\fI\341|\333_\240 \301\253\t\f\16u(\325"..., 4631) = 4631
write(4, "?z6\256g\256\324v\232[\37F\253l\225\236\264\320is\375i"..., 4096) = 4096
write(4, "?*\351\325\235\337Z%6`\2155T\v\6`\17-\210\214S\200\4\16"..., 4096) = 4096
gettimeofday({1047095483, 208491}, NULL) = 0
gettimeofday({1047095483, 208540}, NULL) = 0
write(2, "\r  0  423M    0  480k    0     0"..., 79^M  0  423M    0  480k    0 
   0  38469      0  3:12:26  0:00:12  3:12:14 55479) = 79
select(4, [3], [], NULL, {1, 0})        = 1 (in [3], left {1, 0})
read(3, "\27\3\1 \30", 5)               = 5
read(3, "\335\201\362\305\226\362\201\354\7\3430\265\256\351[\256"..., 8216) = 8216
write(4, "W$\313K\27\336-\217\371_[I4H\347\0212\10\236\347&\342\314"..., 4096) =
4096
write(4, "+\225gL\22\t\2731\262\4\17\202\217\346\355\361\36\277N"..., 4096) = 4096
gettimeofday({1047095483, 210112}, NULL) = 0
gettimeofday({1047095483, 210158}, NULL) = 0
select(4, [3], [], NULL, {1, 0})        = 1 (in [3], left {1, 0})
read(3, "\27\3\1 \30", 5)               = 5
read(3, "W>7$\306\32\264q\334V\343\36\16\247\341\27\313\324\376"..., 8216) = 1743
read(3, 0x8087794, 6473)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
read(3, 0x8087794, 6473)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
read(3, 0x8087794, 6473)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
read(3, 0x8087794, 6473)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
-----
and the {EAGAIN, getpid()} loop repeats 1726 times until
-----
read(3, "];j\\Z\351\205\204\213\3648#K\360\326\34\365\277\5\265"..., 6473) = 6473  
write(4, "\301\2403mKe\240\327\203\352\215R\v\243\244\34h\260z\335"..., 4096) = 4096
write(4, "\34\314\0214\30\32tV\r\25\5\1y\265\374F\260\200v\210\251"..., 4096) = 4096
gettimeofday({1047095483, 356988}, NULL) = 0
gettimeofday({1047095483, 357037}, NULL) = 0
select(4, [3], [], NULL, {1, 0})        = 1 (in [3], left {1, 0})
read(3, "\27\3\1 \30", 5)               = 5
read(3, "y\263\311P8\223l\221\306\217\34%SKq\251\375$\5\337rc8>"..., 8216) = 8216
write(4, "&4\351\36Z\24\373\364\277G\276\37\2\245\r\324\17R&\217"..., 4096) = 4096
write(4, "\7\300E\373\243Bl\234g\7C\r\327D\27\366\257y\324_mB\317"..., 4096) = 4096
gettimeofday({1047095483, 358525}, NULL) = 0
gettimeofday({1047095483, 358571}, NULL) = 0
select(4, [3], [], NULL, {1, 0})        = 1 (in [3], left {1, 0})
read(3, "\27\3\1 \30", 5)               = 5
read(3, "\246\227\27n\275\346yi\260\336.d\\\20\242L&\266q=(B\310"..., 8216) = 4281
read(3, 0x808817e, 3935)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
read(3, 0x808817e, 3935)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
-----
and the {EAGAIN, getpid()} loop repeats 524 times until
-----
read(3, 0x808817e, 3935)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
read(3, "\6\344\222.\344\226c$0\263L\343\277*\3519\260\2513i2\304"..., 3935) = 1460
read(3, 0x8088732, 2475)                = -1 EAGAIN (Resource temporarily
unavailable)
getpid()                                = 3046
-----
and so on.
Comment 1 John Reiser 2003-03-08 19:58:40 EST
Here are the shared libraries:

$ ldd $(which curl)
	libcurl.so.2 => /usr/lib/libcurl.so.2 (0x4002a000)
	libssl.so.2 => /lib/libssl.so.2 (0x4004a000)
	libcrypto.so.2 => /lib/libcrypto.so.2 (0x40077000)
	libdl.so.2 => /lib/libdl.so.2 (0x4013b000)
	libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

and the links showing versions:

lrwxrwxrwx    1 root     root           16 Jun 12  2002 /usr/lib/libcurl.so.2 ->
libcurl.so.2.0.2
lrwxrwxrwx    1 root     root           16 May 25  2002 /lib/libssl.so.2 ->
libssl.so.0.9.6b
lrwxrwxrwx    1 root     root           19 May 25  2002 /lib/libcrypto.so.2 ->
libcrypto.so.0.9.6b
lrwxrwxrwx    1 root     root           14 Nov 16 13:12 /lib/libdl.so.2 ->
libdl-2.2.5.so
lrwxrwxrwx    1 root     root           13 Nov 16 13:12 /lib/i686/libc.so.6 ->
libc-2.2.5.so
lrwxrwxrwx    1 root     root           11 Nov 16 13:12 /lib/ld-linux.so.2 ->
ld-2.2.5.so
Comment 2 Eido Inoue 2003-03-10 12:40:26 EST
(comment from the curl author)

known problem in curl prior to version 7.10.3.
Comment 3 Eido Inoue 2003-07-01 12:43:46 EDT
fixed in rawhide's 7.10.5

Note You need to log in before you can comment on or make changes to this bug.