Bug 187753 - kio_http seem to hang with "HTTP/1.1 401 Malformed security token" responses using 100% cpu
Summary: kio_http seem to hang with "HTTP/1.1 401 Malformed security token" responses ...
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: http (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 190501 190941 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-21 00:59 UTC by Sten Heinze
Modified: 2009-04-28 20:34 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Captured network traffic (145.36 KB, text/plain)
2009-03-21 01:11 UTC, Sten Heinze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sten Heinze 2009-03-21 00:59:06 UTC
Version:            (using KDE 4.2.1)
Compiler:          gcc 4.3.3-3 (from Debian testing) 
OS:                Linux
Installed from:    Debian testing/unstable Packages

kio_http seem to hang when when it receives "HTTP/1.1 401 Malformed security token" responses while consuming increasing amount of cpu time: I had 15 kio_http processing running, while 2 used ~10% cpu each when I noticed it. Over the course of a few hours this increased to ~50% per process.

Attaching gdb to one of the processes resulted in the following two backtraces:

$ gdb attach 25143
[...]
(gdb) bt
#0  0xb7f74b7d in QCoreApplicationPrivate::removePostedEvents_unlocked (receiver=0x9bd9440, eventType=0, data=0x8cf7a88) at kernel/qcoreapplication.cpp:1301
#1  0xb7f8be12 in ~QObject (this=0x9bd9440) at kernel/qobject.cpp:890
#2  0xb7f0a438 in ~QIODevice (this=0x9bd9440) at io/qiodevice.cpp:395
#3  0xb7ef5a1d in ~QBuffer (this=0x9bd9440) at io/qbuffer.cpp:199
#4  0xb7ef6155 in ~QDataStream (this=0xbf985b08) at io/qdatastream.cpp:320
#5  0xb79d88b7 in KIO::SlaveBase::infoMessage (this=0xbf986178, _msg=@0xbf985d0c) at ../../kio/kio/slavebase.cpp:640
#6  0xb6067a1e in HTTPProtocol::sendQuery (this=0xbf986170) at ../../../kioslave/http/http.cpp:2440
#7  0xb6071677 in HTTPProtocol::proceedUntilResponseHeader (this=0xbf986170) at ../../../kioslave/http/http.cpp:565
#8  0xb6072a1e in HTTPProtocol::proceedUntilResponseContent (this=0xbf986170, dataInternal=false) at ../../../kioslave/http/http.cpp:536
#9  0xb6073791 in HTTPProtocol::post (this=0xbf986170, url=@0xbf985fc8) at ../../../kioslave/http/http.cpp:1375
#10 0xb6073cb6 in HTTPProtocol::special (this=0xbf986170, data=@0xbf986130) at ../../../kioslave/http/http.cpp:3865
#11 0xb79e0a36 in KIO::SlaveBase::dispatch (this=0xbf986178, command=77, data=@0xbf986130) at ../../kio/kio/slavebase.cpp:1159
#12 0xb79df44c in KIO::SlaveBase::dispatchLoop (this=0xbf986178) at ../../kio/kio/slavebase.cpp:282
#13 0xb605aa5b in kdemain (argc=4, argv=0x8d1c508) at ../../../kioslave/http/http.cpp:110
#14 0x0804dce1 in launch (argc=4, _name=0x8d1c8ec "kio_http", args=0x8d1c96b "", cwd=0x0, envc=0, envs=0x8d1c970 "", reset_env=false, tty=0x0,
    avoid_loops=false, startup_id_str=0x8050a03 "0") at ../../kinit/kinit.cpp:692
#15 0x0804e41d in handle_launcher_request (sock=7) at ../../kinit/kinit.cpp:1273
#16 0x0804e93a in handle_requests (waitForPid=0) at ../../kinit/kinit.cpp:1466
#17 0x0804f0ac in main (argc=2, argv=0xbf986a34, envp=0xbf986a40) at ../../kinit/kinit.cpp:1951
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
[Switching to Thread 0xb61f3b00 (LWP 25143)]
0xb806a424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb806a424 in __kernel_vsyscall ()
#1  0xb6a673d3 in write () from /lib/i686/cmov/libc.so.6
#2  0xb67f91f1 in ?? () from /usr/lib/libQtNetwork.so.4
#3  0xb67e3078 in ?? () from /usr/lib/libQtNetwork.so.4
#4  0xb67f179c in ?? () from /usr/lib/libQtNetwork.so.4
#5  0xb67f1b36 in ?? () from /usr/lib/libQtNetwork.so.4
#6  0xb67f29bd in QAbstractSocket::waitForBytesWritten () from /usr/lib/libQtNetwork.so.4
#7  0xb78ece6b in KIO::SocketConnectionBackend::sendCommand (this=0x8da8690, task=@0xbf9859b8) at ../../kio/kio/connection.cpp:294
#8  0xb78ecc53 in KIO::Connection::sendnow (this=0x8da604c, _cmd=26, data=@0xbf985a58) at ../../kio/kio/connection.cpp:502
#9  0xb78ed9ef in KIO::Connection::send (this=0x8da604c, cmd=26, data=@0xbf985a58) at ../../kio/kio/connection.cpp:486
#10 0xb79d7fdd in KIO::SlaveBase::send (this=0xbf986178, cmd=26, arr=@0xbf985a58) at ../../kio/kio/slavebase.cpp:1330
#11 0xb79d88af in KIO::SlaveBase::infoMessage (this=0xbf986178, _msg=@0xbf985b0c) at ../../kio/kio/slavebase.cpp:640
#12 0xb605b1fa in HTTPProtocol::sendBody (this=0xbf986170) at ../../../kioslave/http/http.cpp:3742
#13 0xb60679c4 in HTTPProtocol::sendQuery (this=0xbf986170) at ../../../kioslave/http/http.cpp:2438
#14 0xb6071677 in HTTPProtocol::proceedUntilResponseHeader (this=0xbf986170) at ../../../kioslave/http/http.cpp:565
#15 0xb6072a1e in HTTPProtocol::proceedUntilResponseContent (this=0xbf986170, dataInternal=false) at ../../../kioslave/http/http.cpp:536
#16 0xb6073791 in HTTPProtocol::post (this=0xbf986170, url=@0xbf985fc8) at ../../../kioslave/http/http.cpp:1375
#17 0xb6073cb6 in HTTPProtocol::special (this=0xbf986170, data=@0xbf986130) at ../../../kioslave/http/http.cpp:3865
#18 0xb79e0a36 in KIO::SlaveBase::dispatch (this=0xbf986178, command=77, data=@0xbf986130) at ../../kio/kio/slavebase.cpp:1159
#19 0xb79df44c in KIO::SlaveBase::dispatchLoop (this=0xbf986178) at ../../kio/kio/slavebase.cpp:282
#20 0xb605aa5b in kdemain (argc=4, argv=0x8d1c508) at ../../../kioslave/http/http.cpp:110
#21 0x0804dce1 in launch (argc=4, _name=0x8d1c8ec "kio_http", args=0x8d1c96b "", cwd=0x0, envc=0, envs=0x8d1c970 "", reset_env=false, tty=0x0,
    avoid_loops=false, startup_id_str=0x8050a03 "0") at ../../kinit/kinit.cpp:692
#22 0x0804e41d in handle_launcher_request (sock=7) at ../../kinit/kinit.cpp:1273
#23 0x0804e93a in handle_requests (waitForPid=0) at ../../kinit/kinit.cpp:1466
#24 0x0804f0ac in main (argc=2, argv=0xbf986a34, envp=0xbf986a40) at ../../kinit/kinit.cpp:1951

Trying to debug this with help of christoph4 did not gave more results:

(gdb) break ../../../kioslave/http/http.cpp:566
Breakpoint 1 at 0xb60715f1: file ../../../kioslave/http/http.cpp, line 566.
(gdb) break ../../../kioslave/http/http.cpp:577
Breakpoint 2 at 0xb6071606: file ../../../kioslave/http/http.cpp, line 577.
(gdb) break ../../../kioslave/http/http.cpp:580
Breakpoint 3 at 0xb607160f: file ../../../kioslave/http/http.cpp, line 580.
(gdb) continue
Continuing.

Program exited normally.

A list of open files before the exit of the program gave (among others):
$ lsof |grep 25143
kio_http  25143 mheinzes   21u     IPv4     568298       0t0    TCP 160.129.138.82:49497->qw-in-f118.google.com:www (ESTABLISHED)

I will send the captured network traffic showing the "HTTP/1.1 401 Malformed security token" responses in a follow-up mail to the bug report.

Regards,
Sten
Comment 1 Sten Heinze 2009-03-21 01:11:48 UTC
Created attachment 32299 [details]
Captured network traffic

Network traffic containing the "HTTP/1.1 401 Malformed security token" responses
Comment 2 auxsvr 2009-03-30 21:20:39 UTC
I have exactly the same problem in KDE 4.2.1, the kio_http processes are left looping and eating bandwidth, and prevent konqueror from exiting. I traced back a process in gdb (up + finish) and it stops here:

Run till exit from #1  0xb5e0aa41 in HTTPProtocol::proceedUntilResponseHeader (this=0xbfe94580)
    at /usr/src/debug/kdelibs-4.2.1/kioslave/http/http.cpp:568
Comment 3 auxsvr 2009-04-02 15:52:01 UTC
Disabling cache fixed it.
Comment 4 Andreas Hartmetz 2009-04-06 12:07:09 UTC
SVN commit 949948 by ahartmetz:

Don't loop if we get no auth request (that we understand) together with a
401/407 status code.
Some whitespace cleanup.
BUG:187753


 M  +24 -14    http.cpp  
 M  +3 -0      http.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=949948
Comment 5 Magnus Kessler 2009-04-07 11:02:03 UTC
Thanks for this fix, which fine and solves this annoying issue with many blogspot (Google friendconnect functionality) and other sites.

Could this be backported to the KDE 4.2 branch, please? I have created a patch for Gentoo, that can be found at http://git.overlays.gentoo.org/gitweb/?p=proj/kde.git;a=blob_plain;f=kde-base/kdelibs/files/kdelibs-4.2-fix_kio_http_401.patch;hb=c1657311b5ad04e24dd8178e051e5cd5c905bae4
Comment 6 Andreas Hartmetz 2009-04-07 14:15:41 UTC
I've backported the fix to 4.2 this morning.
Comment 7 Maksim Orlovich 2009-04-24 20:28:43 UTC
*** Bug 190501 has been marked as a duplicate of this bug. ***
Comment 8 Maksim Orlovich 2009-04-28 20:34:13 UTC
*** Bug 190941 has been marked as a duplicate of this bug. ***