RESOLVED FIXED 104615
[Chromium] IndexedDB: Memory leak in IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabaseBackendInterface>)
https://bugs.webkit.org/show_bug.cgi?id=104615
Summary [Chromium] IndexedDB: Memory leak in IDBCallbacksProxy::onSuccess(PassRefPtr<...
Joshua Bell
Reported 2012-12-10 17:03:10 PST
https://code.google.com/p/chromium/issues/detail?id=122249 Valgrind says: { bug_122249d Memcheck:Leak fun:_Znw* fun:_ZN6WebKit17IDBCallbacksProxy9onSuccessEN3WTF10PassRefPtrIN7WebCore27IDBDatabaseBackendInterfaceEEE fun:_ZN7WebCore22IDBDatabaseBackendImpl19processPendingCallsEv fun:_ZN7WebCore22IDBDatabaseBackendImpl35transactionFinishedAndCompleteFiredEN3WTF10PassRefPtrINS_25IDBTransactionBackendImplEEE fun:_ZN7WebCore25IDBTransactionBackendImpl6commitEv } Leak is pretty obvious, here's a speculative fix but I haven't run it through valgrind yet: void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* webKitInstance) { + OwnPtr<WebIDBDatabase> webDatabase = adoptPtr(webKitInstance); if (m_databaseProxy) { m_callbacks->onSuccess(m_databaseProxy.release()); return; } - m_callbacks->onSuccess(IDBDatabaseBackendProxy::create(adoptPtr(webKitInstance))); + m_callbacks->onSuccess(IDBDatabaseBackendProxy::create(webDatabase.release())); }
Attachments
Patch (1.73 KB, patch)
2012-12-10 17:24 PST, Joshua Bell
no flags
Patch (3.04 KB, patch)
2012-12-14 13:15 PST, Joshua Bell
no flags
Joshua Bell
Comment 1 2012-12-10 17:24:13 PST
Joshua Bell
Comment 2 2012-12-10 17:25:24 PST
dgrogan@, alecflett@ - please take a look Verified this addresses the leak w/ valgrind, at least in basics.html
David Grogan
Comment 3 2012-12-10 18:56:05 PST
Comment on attachment 178674 [details] Patch LGTM
Joshua Bell
Comment 4 2012-12-10 20:07:52 PST
tony@ - r?
WebKit Review Bot
Comment 5 2012-12-11 10:14:17 PST
Comment on attachment 178674 [details] Patch Clearing flags on attachment: 178674 Committed r137330: <http://trac.webkit.org/changeset/137330>
WebKit Review Bot
Comment 6 2012-12-11 10:14:21 PST
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 7 2012-12-11 14:25:56 PST
Re-opened since this is blocked by bug 104719
Joshua Bell
Comment 8 2012-12-14 13:15:29 PST
Joshua Bell
Comment 9 2012-12-14 13:17:22 PST
The previous patch was on the receiving end, and didn't account for the "real" Chromium implementation which correct passed in the right objects. For the Chromium-DRT implementation, simply don't generate a new wrapper object if one was sent through in onUpgradeNeeded, and let it be ignored. dgrogan@ - another look?
David Grogan
Comment 10 2012-12-14 13:57:20 PST
In chromium, won't this cause IndexedDBCallbacksDatabase::onSuccess(WebKit::WebIDBDatabase* idb_object) to attempt to delete NULL? Also, to ensure I understand, this leak only happens in DRT, correct? Not chromium?
Joshua Bell
Comment 11 2012-12-14 14:05:15 PST
(In reply to comment #10) > In chromium, won't this cause > > IndexedDBCallbacksDatabase::onSuccess(WebKit::WebIDBDatabase* idb_object) > > to attempt to delete NULL? Correct (but delete null is a safe no-op in C++) > Also, to ensure I understand, this leak only happens in DRT, correct? Not chromium? Correct. (Well, Chromium's DRT to be precise, it wouldn't affect other ports.)
David Grogan
Comment 12 2012-12-14 14:06:07 PST
LGTM
Joshua Bell
Comment 13 2012-12-14 14:10:41 PST
tony@ - patch is completely different, so can you take another look?
WebKit Review Bot
Comment 14 2012-12-14 14:32:57 PST
Comment on attachment 179521 [details] Patch Clearing flags on attachment: 179521 Committed r137773: <http://trac.webkit.org/changeset/137773>
WebKit Review Bot
Comment 15 2012-12-14 14:33:01 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.