[Bug 175967] New: Error in gzread while loading from cache gives infinite loop in kio_http

Brendon Higgins blhiggins at gmail.com
Mon Nov 24 10:25:30 CET 2008


           Summary: Error in gzread while loading from cache gives infinite
                    loop in kio_http
           Product: kio
           Version: 4.1
          Platform: Debian testing
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: http
        AssignedTo: kdelibs-bugs at kde.org
        ReportedBy: blhiggins at gmail.com

Version:            (using KDE 4.1.3)
OS:                Linux
Installed from:    Debian testing/unstable Packages

Symptom: Occasionally (frequent enough to be annoying) I find runaway kio_http
processes devouring an entire CPU core.

Investigation: I attached gdb to one such process and discovered that it was
looping, presumably infinitely, at the while loop beginning at line 4244 of
kdelibs/kioslave/http/http.cpp (KDE 4.1.3 version). Indicitavely, nbytes is -1.
I.e., gzread is failing.

Looking at the documentation I've found, it seems that gzeof does not return 1
on error. There seems to be numerous documentations of the function on the net
that indicate that it does, however note that
http://www.zlib.net/manual.html#gzeof (the authoritative source, I would
expect) only specifies that the function returns 1 if EOF has been previously
detected, otherwise 0, which says nothing about errors.

Solution: I notice code within this section of http.cpp to check gzerror has
been commented out. Maybe someone thought it was superfluous (given the
erroneous documentations I've found, this is possible), or perhaps the error
handling is incomplete, or something; I don't know. Either this ought to be
used, or nbytes checked for negativity.

Pondering what actually might trigger this, I wonder: Is the cache thread safe?
I mean, what would happen if I were to open two tabs of the same site, such
that one tab starts writing to the cache, but the other tab attempts to read it
before it's written completely? It may be a symptom of a bigger problem.

Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the Kdelibs-bugs mailing list