Bug 180631 - Extremely long load time on www.abclinuxu.cz
Summary: Extremely long load time on www.abclinuxu.cz
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-14 09:51 UTC by Michal Vyskocil
Modified: 2009-02-16 15:35 UTC (History)
4 users (show)

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


Attachments
The text export from Wireshark (32.11 KB, text/plain)
2009-01-14 09:54 UTC, Michal Vyskocil
Details
Konqueror debug log - waiting (109.62 KB, text/x-log)
2009-01-15 13:39 UTC, Jaroslav Reznik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Vyskocil 2009-01-14 09:51:04 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

The kde4-konqueror 4.1.87 have an extremely load time on www.abclinuxu.cz. The problem is not in network settings, as Firefox works well on that site and a Konqueror has no problem with load of any other site.

This is a regression from older version as older trunk snapshots of 4.2 didn't has this problem and 4.1.3 works well too.

Steps to reproduce:
Visit the abclinuxu.cz and click on the any link on the page. The Konqueror will try to load the page, but it tooks a lot of time with messages like waiting on abclinuxu.cz, retriewing of 17,5 kb from abclinuxu, 15 of 16 images loaded, ... This doesn't have an impact on cpu utilisation, which is low (cca 3%).
Comment 1 Michal Vyskocil 2009-01-14 09:54:18 UTC
Created attachment 30233 [details]
The text export from Wireshark

I used a Wireshark to capture of HTTP communication between Konqueror and abclinuxu.cz site - http://www.abclinuxu.cz/blog/techblog/2009/1/entropa. The filter value was 'http and ip.addr==195.70.150.7'. You can see there is a big delay between every server response and another Konqueror's GET.
Comment 2 Maksim Orlovich 2009-01-14 17:49:33 UTC
Can confirm that. Very interesting.
Comment 3 Jaroslav Reznik 2009-01-15 13:29:37 UTC
I can confirm it too in 4.1.96. Refresh works - page is loaded instantly! 
Comment 4 Jaroslav Reznik 2009-01-15 13:39:11 UTC
Created attachment 30275 [details]
Konqueror debug log - waiting

Also I have log after refresh instead waiting so if it helps I can upload too.
Comment 5 Maksim Orlovich 2009-01-31 23:27:32 UTC
Potential fix below. The problem seems to occur because we get the 304 response + headers in the single read. Then, we parse the response, unget the headers, and then when trying to get the headers next do a blocking read. This make it return unget buffer first:

Index: http.cpp
===================================================================
--- http.cpp	(revision 919318)
+++ http.cpp	(working copy)
@@ -1861,6 +1861,8 @@
     m_unreadBuf.clear();
 }
 
+// Note: the implementation of unread/readBuffered assumes that unread will only 
+// be used when there is extra data we don't want to handle, and not to wait for more data.
 void HTTPProtocol::unread(char *buf, size_t size)
 {
     // implement LIFO (stack) semantics
@@ -1886,6 +1888,10 @@
             buf[i] = m_unreadBuf.constData()[bufSize - i - 1];
         }
         m_unreadBuf.truncate(bufSize - bytesRead);
+
+        // if we have an unread buffer, return here, since we may already have enough data to 
+        // complete the response, so we don't want to wait for more.
+        return bytesRead;
     }
     if (bytesRead < size) {
         int rawRead = TCPSlaveBase::read(buf + bytesRead, size - bytesRead);
Comment 6 David Watzke 2009-02-01 11:53:18 UTC
It works fine now, thanks man!

(Btw, it's the `kioslave/http/http.cpp' file in kdelibs)
Comment 7 Michal Vyskocil 2009-02-07 09:55:13 UTC
@Maksim: thanks for the fix, now it's OK. It's possible to commit it to svn?
Comment 8 Maksim Orlovich 2009-02-16 15:35:05 UTC
SVN commit 926999 by orlovich:

Make sure we don't do any extra blocking reads if we still have buffered data to process; 
fixes freezes on websites with extremely small reply headers, like abclinuxu.cz

BUG:180631


 M  +6 -0      http.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=926999