Bug 193167 - IndexedDB: leak IDBTransaction, TransactionOperation and IDBRequest in layout tests
Summary: IndexedDB: leak IDBTransaction, TransactionOperation and IDBRequest in layout...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-04 18:15 PST by Sihui Liu
Modified: 2019-01-11 16:37 PST (History)
8 users (show)

See Also:


Attachments
Patch (7.27 KB, patch)
2019-01-04 19:13 PST, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (3.79 KB, patch)
2019-01-10 10:05 PST, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (3.98 KB, patch)
2019-01-10 12:01 PST, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2019-01-04 18:15:03 PST
Found by running layout tests using --leak option.
Comment 1 Sihui Liu 2019-01-04 18:16:06 PST
<rdar://problem/46891688>
Comment 2 Sihui Liu 2019-01-04 18:17:27 PST
STACK OF 1 INSTANCE OF 'ROOT CYCLE: <WebCore>':
[thread 0x10b2605c0]:
39  libdyld.dylib                      0x7fff7834c3f1 start + 1
38  com.apple.WebKit.WebContent           0x100fb8867 invocation function for block in WebKit::XPCServiceEventHandler(NSObject<OS_xpc_object>*) + 0  XPCServiceMain.mm:46
37  com.apple.WebKit.WebContent           0x100fb86e2 WebKit::XPCServiceMain(int, char const**) + 547  XPCServiceMain.mm:0
36  libxpc.dylib                       0x7fff78580ce5 _xpc_copy_xpcservice_dictionary + 0
35  libxpc.dylib                       0x7fff785811e3 _xpc_objc_main + 552
34  com.apple.Foundation               0x7fff4de1e334 -[NSRunLoop(NSRunLoop) run] + 76
33  com.apple.Foundation               0x7fff4de1e45f -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 280
32  com.apple.CoreFoundation           0x7fff4bae201a CFRunLoopRunSpecific + 455
31  com.apple.CoreFoundation           0x7fff4bae2ae3 __CFRunLoopRun + 2167
30  com.apple.CoreFoundation           0x7fff4bb01912 __CFRunLoopDoTimers + 330
29  com.apple.CoreFoundation           0x7fff4bb01dcc __CFRunLoopDoTimer + 851
28  com.apple.CoreFoundation           0x7fff4bb02220 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
27  com.apple.WebCore                     0x103666a0f WebCore::timerFired(__CFRunLoopTimer*, void*) + 31  MainThreadSharedTimerCF.cpp:75
26  com.apple.WebCore                     0x1036450e0 WebCore::ThreadTimers::sharedTimerFiredInternal() + 176  ThreadTimers.cpp:120
25  com.apple.WebCore                     0x1030fd77c WebCore::DocumentEventQueue::pendingEventTimerFired() + 284  utility:898
24  com.apple.WebCore                     0x102d03ba8 WebCore::IDBOpenDBRequest::dispatchEvent(WebCore::Event&) + 24  RefPtr.h:87
23  com.apple.WebCore                     0x102d03d42 WebCore::IDBRequest::dispatchEvent(WebCore::Event&) + 274  IDBTransaction.cpp:1354
22  com.apple.WebCore                     0x10312b097 WebCore::EventDispatcher::dispatchEvent(WTF::Vector<WebCore::EventTarget*, 0ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::Event&) + 119  EventDispatcher.cpp:186
21  com.apple.WebCore                     0x10312afee WebCore::dispatchEventInDOM(WebCore::Event&, WebCore::EventPath const&) + 222  Event.h:114
20  com.apple.WebCore                     0x10312e5a3 WebCore::EventTarget::fireEventListeners(WebCore::Event&, WebCore::EventTarget::EventInvokePhase) + 515  Vector.h:674
19  com.apple.WebCore                     0x103130639 WebCore::EventTarget::innerInvokeEventListeners(WebCore::Event&, WTF::Vector<WTF::RefPtr<WebCore::RegisteredEventListener, WTF::DumbPtrTraits<WebCore::RegisteredEventListener> >, 1ul, WTF::CrashOnOverflow, 16ul>, WebCore::EventTarget::EventInvokePhase) + 825  InspectorInstrumentation.h:282
18  com.apple.WebCore                     0x102eb502f WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext&, WebCore::Event&) + 1023  JSEventListener.cpp:175
17  com.apple.WebCore                     0x102e9d4e4 WebCore::JSExecState::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&) + 100  JSExecState.h:74
16  com.apple.JavaScriptCore              0x1073abe0b JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&) + 187  CallData.cpp:41
15  com.apple.JavaScriptCore              0x1071644a0 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 464  JITCodeInlines.h:39
14  com.apple.JavaScriptCore              0x106b89ba9 vmEntryToJavaScript + 200  LowLevelInterpreter64.asm:295
13  com.apple.JavaScriptCore              0x106b99001 llint_entry + 62110  LowLevelInterpreter.asm:899
12  com.apple.JavaScriptCore              0x106b9a042 llint_entry + 66271  LowLevelInterpreter.asm:995
11  com.apple.JavaScriptCore              0x1072699ef JSC::LLInt::commonCallEval(JSC::ExecState*, JSC::Instruction const*, JSC::MacroAssemblerCodePtr<(WTF::PtrTag)357>) + 255  LLIntSlowPaths.cpp:1745
10  com.apple.JavaScriptCore              0x10715e018 JSC::eval(JSC::ExecState*) + 664  Interpreter.cpp:171
9   com.apple.JavaScriptCore              0x10715efe2 JSC::Interpreter::execute(JSC::EvalExecutable*, JSC::ExecState*, JSC::JSValue, JSC::JSScope*) + 2194  JITCodeInlines.h:39
8   com.apple.JavaScriptCore              0x106b89ba9 vmEntryToJavaScript + 200  LowLevelInterpreter64.asm:295
7   com.apple.JavaScriptCore              0x106b99001 llint_entry + 62110  LowLevelInterpreter.asm:899
6                                      0x3a98e6201177 0x3a98e6201000 + 375
5   com.apple.WebCore                     0x1029029f2 WebCore::jsIDBDatabasePrototypeFunctionCreateObjectStore(JSC::ExecState*) + 418  Expected.h:487
4   com.apple.WebCore                     0x102cf1287 WebCore::IDBDatabase::createObjectStore(WTF::String const&, WebCore::IDBDatabase::ObjectStoreParameters&&) + 375  utility:898
3   com.apple.WebCore                     0x102d0a1ef WebCore::IDBTransaction::createObjectStore(WebCore::IDBObjectStoreInfo const&) + 127  ThreadSafeRefCounted.h:37
2   com.apple.JavaScriptCore              0x106949a2b WTF::fastMalloc(unsigned long) + 91  FastMalloc.cpp:279
1   com.apple.JavaScriptCore              0x1069b8c8c bmalloc::DebugHeap::malloc(unsigned long) + 12  DebugHeap.cpp:49
0   libsystem_malloc.dylib             0x7fff784f7b19 malloc_zone_malloc + 139 
====
    3 (256 bytes) ROOT CYCLE: <WebCore::IDBClient::TransactionOperationImpl<WebCore::IDBObjectStoreInfo const&> 0x7f85d6b32530> [112]
       1 (128 bytes) ROOT CYCLE: <WTF::Function<void ()>::CallableWrapper<WebCore::IDBClient::TransactionOperationImpl<WebCore::IDBObjectStoreInfo const&>::TransactionOperationImpl(WebCore::IDBTransaction&, void (WebCore::IDBTransaction::*)(WebCore::IDBResultData const&), void (WebCore::IDBTransaction::*)(WebCore::IDBClient::TransactionOperation&, WebCore::IDBObjectStoreInfo const&), WebCore::IDBObjectStoreInfo const&)::'lambda'()> 0x7f85d6b90940> [128]
          CYCLE BACK TO <WebCore::IDBClient::TransactionOperationImpl<WebCore::IDBObjectStoreInfo const&> 0x7f85d6b32530> [112]
       1 (16 bytes) 0x7f85d6b2b570 [16]
Comment 3 Sihui Liu 2019-01-04 18:19:01 PST
STACK OF 1 INSTANCE OF 'ROOT CYCLE: <WTF>':
[thread 0x1116435c0]:
25  libdyld.dylib                      0x7fff7834c3f1 start + 1
24  com.apple.WebKit.WebContent           0x10c62c867 invocation function for block in WebKit::XPCServiceEventHandler(NSObject<OS_xpc_object>*) + 0  XPCServiceMain.mm:46
23  com.apple.WebKit.WebContent           0x10c62c6e2 WebKit::XPCServiceMain(int, char const**) + 547  XPCServiceMain.mm:0
22  libxpc.dylib                       0x7fff78580ce5 _xpc_copy_xpcservice_dictionary + 0
21  libxpc.dylib                       0x7fff785811e3 _xpc_objc_main + 552
20  com.apple.Foundation               0x7fff4de1e334 -[NSRunLoop(NSRunLoop) run] + 76
19  com.apple.Foundation               0x7fff4de1e45f -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 280
18  com.apple.CoreFoundation           0x7fff4bae201a CFRunLoopRunSpecific + 455
17  com.apple.CoreFoundation           0x7fff4bae2726 __CFRunLoopRun + 1210
16  com.apple.CoreFoundation           0x7fff4bae317c __CFRunLoopDoSources0 + 195
15  com.apple.CoreFoundation           0x7fff4baff7e9 __CFRunLoopDoSource0 + 108
14  com.apple.CoreFoundation           0x7fff4baff843 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
13  com.apple.JavaScriptCore              0x660b75792 WTF::RunLoop::performWork(void*) + 34  RunLoopCF.cpp:39
12  com.apple.JavaScriptCore              0x660b75504 WTF::RunLoop::performWork() + 228  Function.h:0
11  com.apple.WebKit                      0x10c64961b IPC::Connection::dispatchOneIncomingMessage() + 181  Connection.cpp:0
10  com.apple.WebKit                      0x10c645fe8 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >) + 108  memory:2603
9   com.apple.WebKit                      0x10c98b7c4 WebKit::NetworkProcessConnection::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 1014  NetworkProcessConnection.cpp:0
8   com.apple.WebKit                      0x10ca09843 void IPC::handleMessage<Messages::WebIDBConnectionToServer::DidOpenDatabase, WebKit::WebIDBConnectionToServer, void (WebKit::WebIDBConnectionToServer::*)(WebCore::IDBResultData const&)>(IPC::Decoder&, WebKit::WebIDBConnectionToServer*, void (WebKit::WebIDBConnectionToServer::*)(WebCore::IDBResultData const&)) + 90  memory:2631
7   com.apple.WebCore                     0x10e3813b2 WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest(WebCore::IDBResultData const&) + 450  RefCounted.h:98
6   com.apple.WebCore                     0x10e37007a WebCore::IDBOpenDBRequest::onUpgradeNeeded(WebCore::IDBResultData const&) + 90  DumbPtrTraits.h:41
5   com.apple.WebCore                     0x10e35dd86 WebCore::IDBDatabase::startVersionChangeTransaction(WebCore::IDBTransactionInfo const&, WebCore::IDBOpenDBRequest&) + 22  DumbPtrTraits.h:41
4   com.apple.WebCore                     0x10e373278 WebCore::IDBTransaction::create(WebCore::IDBDatabase&, WebCore::IDBTransactionInfo const&, WebCore::IDBOpenDBRequest&) + 56  Ref.h:147
3   com.apple.WebCore                     0x10e373404 WebCore::IDBTransaction::IDBTransaction(WebCore::IDBDatabase&, WebCore::IDBTransactionInfo const&, WebCore::IDBOpenDBRequest*) + 372  Function.h:95
2   com.apple.JavaScriptCore              0x660b59a2b WTF::fastMalloc(unsigned long) + 91  FastMalloc.cpp:279
1   com.apple.JavaScriptCore              0x660bc8c8c bmalloc::DebugHeap::malloc(unsigned long) + 12  DebugHeap.cpp:49
0   libsystem_malloc.dylib             0x7fff784f7b19 malloc_zone_malloc + 139 
====
    14 (2.72K) ROOT CYCLE: <WTF::Function<void ()>::CallableWrapper<std::__1::__bind<void (WebCore::IDBTransaction::*&)(), WebCore::IDBTransaction*> > 0x7f929b07f700> [32]
       13 (2.69K) ROOT CYCLE: <WebCore::IDBTransaction 0x7f929b06dc20> [624]
          CYCLE BACK TO <WTF::Function<void ()>::CallableWrapper<std::__1::__bind<void (WebCore::IDBTransaction::*&)(), WebCore::IDBTransaction*> > 0x7f929b07f700> [32]
          2 (400 bytes) ROOT CYCLE: 0x7f929b07f9e0 [128]
             1 (272 bytes) ROOT CYCLE: <WebCore::IDBObjectStore 0x7f929b042dc0> [272]
          3 (368 bytes) ROOT CYCLE: 0x7f929b05a640 [128]
             2 (240 bytes) ROOT CYCLE: <WebCore::IDBClient::TransactionOperationImpl<WebCore::IDBObjectStoreInfo const&> 0x7f929b018b50> [112]
                1 (128 bytes) ROOT CYCLE: <WTF::Function<void ()>::CallableWrapper<WebCore::IDBClient::TransactionOperationImpl<WebCore::IDBObjectStoreInfo const&>::TransactionOperationImpl(WebCore::IDBTransaction&, void (WebCore::IDBTransaction::*)(WebCore::IDBResultData const&), void (WebCore::IDBTransaction::*)(WebCore::IDBClient::TransactionOperation&, WebCore::IDBObjectStoreInfo const&), WebCore::IDBObjectStoreInfo const&)::'lambda'()> 0x7f929b018bc0> [128]
          1 (128 bytes) ROOT CYCLE: 0x7f929b03aed0 [128]
          1 (32 bytes) ROOT CYCLE: <WTF::Function<void ()>::CallableWrapper<std::__1::__bind<void (WebCore::IDBTransaction::*&)(), WebCore::IDBTransaction*> > 0x7f929b077ce0> [32]
          2 (816 bytes) 0x7f929881a6d0 [48]
             1 (768 bytes) 0x7f929b0779e0 [768]
          1 (192 bytes) 0x7f929b05a6c0 [192]
          1 (128 bytes) 0x7f929b03ae30 [128]
          1 (64 bytes) 0x7f929b018ae0 [64]
Comment 4 Sihui Liu 2019-01-04 19:13:31 PST
Created attachment 358421 [details]
Patch
Comment 5 Sihui Liu 2019-01-10 10:05:34 PST
Created attachment 358803 [details]
Patch
Comment 6 Geoffrey Garen 2019-01-10 10:56:07 PST
Comment on attachment 358803 [details]
Patch

r=me
Comment 7 Geoffrey Garen 2019-01-10 10:56:40 PST
Comment on attachment 358803 [details]
Patch

Seems like these test failures are related:

  crypto/subtle/rsa-indexeddb-private.html [ Crash ]
  crypto/subtle/rsa-indexeddb.html [ Crash ]
  fast/history/page-cache-indexed-opened-db.html [ Crash ]
  http/tests/IndexedDB/collect-IDB-objects.https.html [ Crash ]
  http/tests/security/cross-origin-worker-indexeddb.html [ Crash ]
  imported/blink/storage/indexeddb/blob-basics-metadata.html [ Crash ]
  imported/blink/storage/indexeddb/blob-valid-before-commit.html [ Crash ]
  imported/blink/storage/indexeddb/empty-blob-file.html [ Crash ]
  imported/w3c/IndexedDB-private-browsing/abort-in-initial-upgradeneeded.html [ Crash ]
  imported/w3c/IndexedDB-private-browsing/close-in-upgradeneeded.html [ Crash ]
  imported/w3c/IndexedDB-private-browsing/cursor-overloads.html [ Crash ]
  imported/w3c/IndexedDB-private-browsing/idbcursor-advance-continue-async.html [ Crash ]
  imported/w3c/IndexedDB-private-browsing/idbcursor-advance-invalid.html [ Crash ]
  imported/w3c/IndexedDB-private-browsing/idbcursor-advance.html [ Crash ]
  imported/w3c/IndexedDB-private-browsing/idbcursor-continue.html [ Crash ]
  imported/w3c/web-platform-tests/IndexedDB/close-in-upgradeneeded.html [ Crash ]
  imported/w3c/web-platform-tests/IndexedDB/cursor-overloads.htm [ Crash ]
  imported/w3c/web-platform-tests/IndexedDB/delete-request-queue.html [ Crash ]
  imported/w3c/web-platform-tests/IndexedDB/error-attributes.html [ Crash ]
  imported/w3c/web-platform-tests/IndexedDB/event-dispatch-active-flag.html [ Crash ]
  imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html [ Crash ]
  imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception.html [ Crash ]
  inspector/indexeddb/requestData.html [ Crash ]
  inspector/indexeddb/requestDatabase.html [ Crash ]
  inspector/indexeddb/requestDatabaseNames.html [ Crash ]
  inspector/unit-tests/objectStore/add.html [ Crash ]
  inspector/unit-tests/objectStore/addObject.html [ Crash ]
  inspector/unit-tests/objectStore/basic.html [ Crash ]
Comment 8 Sihui Liu 2019-01-10 12:01:04 PST
Created attachment 358815 [details]
Patch
Comment 9 Geoffrey Garen 2019-01-10 13:10:49 PST
Comment on attachment 358815 [details]
Patch

r=me
Comment 10 WebKit Commit Bot 2019-01-11 12:21:14 PST
Comment on attachment 358815 [details]
Patch

Clearing flags on attachment: 358815

Committed r239865: <https://trac.webkit.org/changeset/239865>
Comment 11 WebKit Commit Bot 2019-01-11 12:21:16 PST
All reviewed patches have been landed.  Closing bug.