Bug 260769 - kio_http asks Qt sockets to read into an already-full buffer
Summary: kio_http asks Qt sockets to read into an already-full buffer
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unmaintained
Component: http (show other bugs)
Version: 4.5
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-20 10:01 UTC by Brendon Higgins
Modified: 2011-01-14 16:43 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.6
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brendon Higgins 2010-12-20 10:01:55 UTC
Version:           4.5 (using KDE 4.5.3) 
OS:                Linux

When transferring a file across a high-bandwidth connection, kio_http can get into a state where it consumes 100% CPU and makes no progress in receiving the transmitted file. I can trigger this, for example, using woof to serve a large file on the local machine, then attempting to download it through konqueror. The kio_http process very quickly becomes busy and unresponsive, and stops downloading.

I found that the cause is due to an issue in Qt (which I have already filed: http://bugreports.qt.nokia.com/browse/QTBUG-16123 - also see the ML posts mentioned there) where if the read buffer is full when the waitForReadyRead method is called, the method will enter an infinite busy loop. It should rather return an error. What makes this problem applicable to KDE, however, is that KDE really should not call waitForReadyRead with a full buffer in the first place - that is asking Qt to fulfill impossible conditions, which of course it can't.

Presumably a future release of Qt will return with an error when this method is called on a full buffer. kio_http should avoid calling waitForReadyRead when there is data already available.

Reproducible: Always

Steps to Reproduce:
Download a file from a fast server over a high-bandwidth connection. A local socket seems to work, too.

Actual Results:  
Some of the file may be downloaded, but soon kio_http stops downloading and consumes 100% CPU.

Expected Results:  
Completed download.
Comment 1 Dawit Alemayehu 2010-12-26 23:42:57 UTC
SVN commit 1209481 by adawit:

- Commented out the code that attempted to do a read ahead optimization because it causes 
  the condition mentioned in BR# 260769.

CCMAIL:ahartmetz@gmail.com
CCBUG:260769


 M  +7 -6      tcpslavebase.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1209481
Comment 2 Dawit Alemayehu 2011-01-14 16:43:12 UTC
See comment #1 and feel free to reopen if the problem persists for you once you have tried KDE 4.6...