Bug 26716

Summary: [Gtk] Each XMLHttpRequest leaks memory.
Product: WebKit Reporter: John Kjellberg <john.kjellberg>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: ap, jmalonzo, xan.lopez
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Test case making XMLHttpRequest every 100ms
none
fixleak.patch zecke: review+

John Kjellberg
Reported 2009-06-25 01:51:43 PDT
I have tried this with WebKit-r43841(and earlier versions also in the past) and GtkLauncher. I have loaded the attached file which makes a XMLHttpRequest request every 100ms. After a half an hour some MB of memory is missing. This continues until the system is really low on memory and slows down and the the oom-killer kills the app. I have checked memory usage in: /proc/<pid>/smaps and it shows increase in "[heap]" memory. This bug is really critical since it makes it impossible to create stable kiosk-applications and such. (This bug is sort of Bug#: 17534, however, I felt that that bug report was really misleading)
Attachments
Test case making XMLHttpRequest every 100ms (232 bytes, text/html)
2009-06-25 01:53 PDT, John Kjellberg
no flags
fixleak.patch (2.32 KB, patch)
2009-07-20 02:38 PDT, Xan Lopez
zecke: review+
John Kjellberg
Comment 1 2009-06-25 01:53:13 PDT
Created attachment 31840 [details] Test case making XMLHttpRequest every 100ms
John Kjellberg
Comment 2 2009-07-07 06:42:58 PDT
I have now done more testing with the nightly build r41128. That is the last version supporting both "curl" and "soup" as HTTP backend. When using "soup" as backend it leaks memory, when using "curl" it doesn't. That the leak is related to "soup" is also confirmed by valgrid testing. I don't know if the leak is in how WebKit uses "soup" of if the leak is in soup itself. I use version 2.26.1 of libsoup.
Jan Alonzo
Comment 3 2009-07-07 06:47:45 PDT
Marking this a Gtk bug for now since it's confirmed that it's in the soup backend.
John Kjellberg
Comment 4 2009-07-07 10:49:58 PDT
I think I how found the problem in: WebCore/platform/network/soup/ResourceHandleSoup.cpp line 581 if ((equalIgnoringCase(protocol, "http") || equalIgnoringCase(protocol, "https")) && SOUP_URI_VALID_FOR_HTTP(soup_uri_new(urlString.utf8().data()))) the call to "soup_uri_new()" should be followed by a "soup_uri_free()". I will take a deeper look at it tomorrow and perhaps create a "proposed patch" if no one beats me too it.
Xan Lopez
Comment 5 2009-07-20 02:38:59 PDT
Created attachment 33075 [details] fixleak.patch I think you are totally right; patch attached.
Xan Lopez
Comment 6 2009-07-20 03:05:29 PDT
Patch landed as r46117.
Note You need to log in before you can comment on or make changes to this bug.