Bug 193688

Summary: IndexedDB: leak WebIDBConnectionToServer in layout tests
Product: WebKit Reporter: Sihui Liu <sihui_liu>
Component: New BugsAssignee: Sihui Liu <sihui_liu>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, ap, beidson, commit-queue, ews-watchlist, ggaren, jsbell, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews104 for mac-highsierra-wk2
none
Archive of layout-test-results from ews126 for ios-simulator-wk2
none
Patch
none
Patch none

Description Sihui Liu 2019-01-22 14:56:08 PST
WebIDBConnectionToServer and IDBConnectionToServer ref each other and never get destroyed.
Comment 1 Sihui Liu 2019-01-22 14:59:48 PST
Created attachment 359781 [details]
Patch
Comment 2 Sihui Liu 2019-01-22 15:00:30 PST
<rdar://problem/47353263>
Comment 3 Geoffrey Garen 2019-01-22 15:33:13 PST
Comment on attachment 359781 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=359781&action=review

r=me

> Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h:149
> +    WeakPtr<IDBConnectionToServerDelegate> m_delegate;

What is the consequence when this pointer becomes null? Is that OK?
Comment 4 EWS Watchlist 2019-01-22 16:04:50 PST
Comment on attachment 359781 [details]
Patch

Attachment 359781 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/10846166

New failing tests:
http/tests/websocket/tests/hybi/no-subprotocol.html
Comment 5 EWS Watchlist 2019-01-22 16:04:51 PST
Created attachment 359796 [details]
Archive of layout-test-results from ews104 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 6 EWS Watchlist 2019-01-22 17:05:41 PST
Comment on attachment 359781 [details]
Patch

Attachment 359781 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10846668

New failing tests:
http/tests/websocket/tests/hybi/no-subprotocol.html
Comment 7 EWS Watchlist 2019-01-22 17:05:42 PST
Created attachment 359814 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 8 Sihui Liu 2019-01-23 13:15:51 PST
Created attachment 359936 [details]
Patch
Comment 9 Sihui Liu 2019-01-23 17:10:04 PST
(In reply to Geoffrey Garen from comment #3)
> Comment on attachment 359781 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=359781&action=review
> 
> r=me
> 
> > Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h:149
> > +    WeakPtr<IDBConnectionToServerDelegate> m_delegate;
> 
> What is the consequence when this pointer becomes null? Is that OK?

If m_delegate is null, it means NetworkProcessConnection derefs WebIDBConnectionToServer and WebIDBConnectionToServer goes away. 

Before NetworkProcessConnection clears the ref to WebIDBConnectionToServer, it calls connectionToServerLost on IDBConnectionToServer and sets m_serverConnectionIsValid to true. If m_serverConnectionIsValid is true, m_delegate won't be used.

So if m_delegate is null, it will not be called.
Comment 10 Sihui Liu 2019-02-01 10:36:21 PST
Created attachment 360872 [details]
Patch
Comment 11 Geoffrey Garen 2019-02-01 13:15:37 PST
Comment on attachment 360872 [details]
Patch

r=me
Comment 12 WebKit Commit Bot 2019-02-04 10:51:26 PST
Comment on attachment 360872 [details]
Patch

Clearing flags on attachment: 360872

Committed r240931: <https://trac.webkit.org/changeset/240931>
Comment 13 WebKit Commit Bot 2019-02-04 10:51:27 PST
All reviewed patches have been landed.  Closing bug.