Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Issue 218953002: Oilpan: IDBCursor should be detached from IDBRequest when the IDBRequest stops (Closed)

Created:
6 years, 8 months ago by haraken
Modified:
6 years, 4 months ago
CC:
blink-reviews, arv+blink, jsbell+bindings_chromium.org, kouhei+bindings_chromium.org, abarth-chromium, marja+watch_chromium.org, adamk+blink_chromium.org, Nate Chapin, Inactive
Visibility:
Public.

Description

Oilpan: IDBCursor should be detached from IDBRequest when the IDBRequest stops This CL fixes the following crash that is happening in oilpan bots flakily. 03:06:22.168 12926 worker/6 storage/indexeddb/cursor-basics.html crashed, (stderr lines): 03:06:22.168 12926 [6:653:0328/030621:3422205696:FATAL:indexed_db_dispatcher.cc(71)] Check failed: false. Re-instantiating TLS IndexedDBDispatcher. 03:06:22.168 12926 #0 0x7f46a76a8ea1 base::debug::StackTrace::StackTrace() 03:06:22.168 12926 #1 0x7f46a772265d logging::LogMessage::~LogMessage() 03:06:22.168 12926 #2 0x7f469cf602f6 content::IndexedDBDispatcher::ThreadSpecificInstance() 03:06:22.168 12926 #3 0x7f469cf78487 content::WebIDBCursorImpl::~WebIDBCursorImpl() 03:06:22.168 12926 #4 0x7f469cf78536 content::WebIDBCursorImpl::~WebIDBCursorImpl() 03:06:22.168 12926 #5 0x7f46a06bb02a WTF::OwnedPtrDeleter<>::deletePtr() 03:06:22.168 12926 #6 0x7f46a09150c3 WTF::OwnPtr<>::~OwnPtr() 03:06:22.168 12926 #7 0x7f46a09120a0 WebCore::IDBCursor::~IDBCursor() 03:06:22.168 12926 #8 0x7f46a0915bce WebCore::IDBCursorWithValue::~IDBCursorWithValue() 03:06:22.168 12926 #9 0x7f46a0915c00 WebCore::IDBCursorWithValue::~IDBCursorWithValue() 03:06:22.168 12926 #10 0x7f46a0911376 WebCore::IDBCursor::deref() 03:06:22.168 12926 #11 0x7f46a09118ff WTF::derefIfNotNull<>() 03:06:22.168 12926 #12 0x7f46a09115bb WTF::RefPtr<>::~RefPtr() 03:06:22.168 12926 #13 0x7f46a0910282 WebCore::IDBAny::~IDBAny() 03:06:22.168 12926 #14 0x7f46a06bb179 WTF::RefCounted<>::deref() 03:06:22.168 12926 #15 0x7f46a06baead WTF::derefIfNotNull<>() 03:06:22.168 12926 #16 0x7f46a09316a4 WTF::RefPtr<>::clear() 03:06:22.168 12926 #17 0x7f46a092eb91 WebCore::IDBRequest::checkForReferenceCycle() 03:06:22.168 12926 #18 0x7f46a092c096 WebCore::IDBRequest::deref() 03:06:22.168 12926 #19 0x7f46a092c033 WebCore::IDBRequest::derefEventTarget() 03:06:22.168 12926 #20 0x7f46a0494a79 WebCore::EventTarget::deref() 03:06:22.168 12926 #21 0x7f46a049552e WTF::derefIfNotNull<>() 03:06:22.168 12926 #22 0x7f46a083fe5d WTF::RefPtr<>::~RefPtr() 03:06:22.169 12926 #23 0x7f46a17aaf7a WebCore::Event::~Event() 03:06:22.169 12926 #24 0x7f46a046f8d9 WebCore::GarbageCollectedFinalized<>::finalizeGarbageCollectedObject() 03:06:22.169 12926 #25 0x7f46a046f833 WebCore::FinalizerTraitImpl<>::finalize() 03:06:22.169 12926 #26 0x7f46a046f5ac WebCore::FinalizerTrait<>::finalize() 03:06:22.169 12926 #27 0x7f46963f028b WebCore::HeapObjectHeader::finalize() 03:06:22.169 12926 #28 0x7f46963f0305 WebCore::FinalizedHeapObjectHeader::finalize() 03:06:22.169 12926 #29 0x7f46963f2ac8 WebCore::HeapPage<>::finalize() 03:06:22.169 12926 #30 0x7f46963f3a64 WebCore::HeapPage<>::sweep() 03:06:22.169 12926 #31 0x7f46963f4e2b WebCore::ThreadHeap<>::sweep() 03:06:22.169 12926 #32 0x7f46963f9f32 WebCore::ThreadState::performPendingSweep() 03:06:22.169 12926 #33 0x7f46963f9c9e WebCore::ThreadState::leaveSafePoint() 03:06:22.169 12926 #34 0x7f46963f1ae9 WebCore::ThreadState::SafePointScope::~SafePointScope() 03:06:22.169 12926 #35 0x7f46963f2a56 WebCore::GCScope::~GCScope() 03:06:22.169 12926 #36 0x7f46963f13d9 WebCore::Heap::collectGarbage() 03:06:22.169 12926 #37 0x7f46963f1402 WebCore::Heap::collectAllGarbage() 03:06:22.169 12926 #38 0x7f46963f8d41 WebCore::ThreadState::cleanup() 03:06:22.169 12926 #39 0x7f46963f8e1e WebCore::ThreadState::detach() 03:06:22.169 12926 #40 0x7f46a1fafad1 WebCore::WorkerThread::workerThread() 03:06:22.169 12926 #41 0x7f46a1faf7d6 WebCore::WorkerThread::workerThreadStart() 03:06:22.169 12926 #42 0x7f4698634f21 WTF::threadEntryPoint() 03:06:22.169 12926 #43 0x7f46986354fd WTF::wtfThreadEntryPoint() 03:06:22.169 12926 #44 0x7f469a330e9a start_thread The cause of the crash is as follows: (1) ~WorkerScriptController() calls m_world->dispose(). (2) m_world->dispose() disposes the last reference to an IDBRequest object. (3) ~WorkerScriptController() calls didStopWorkerRunLoop(). (4) didStopWorkerRunLoop() destructs an IndexedDBDispatcher object in the Chromium side. (5) At the end of the worker thread execution, ThreadState::detach() is called. ThreadState::detach() triggers a GC. (6) The GC collects the IDBRequest object. (7) ~IDBRequest() calls ~IDBCursor(), which touches the IndexedDBDispatcher object, which is already destroyed. The problem here is that the IDBCursor is not detached from the IDBRequest when the IDBRequest::stop() is called (Note: IDBRequest::stop() is called when the associated execution context is stopped). This CL fixes the crash by clearing out IDBRequest::m_result in IDBRequest::stop(). BUG=340522

Patch Set 1 #

Total comments: 2

Patch Set 2 : #

Total comments: 4

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -0 lines) Patch
M Source/modules/indexeddb/IDBRequest.cpp View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 30 (0 generated)
haraken
PTAL
6 years, 8 months ago (2014-03-31 03:45:30 UTC) #1
haraken
If you want to know more about the destruction dependency of IDB objects, you can ...
6 years, 8 months ago (2014-03-31 03:46:49 UTC) #2
zerny-chromium
It seems odd to force multiple GC's before and after didStopWorkerRunLoop. To me the issue ...
6 years, 8 months ago (2014-03-31 06:33:10 UTC) #3
Mads Ager (chromium)
https://codereview.chromium.org/218953002/diff/1/Source/bindings/v8/WorkerScriptController.cpp File Source/bindings/v8/WorkerScriptController.cpp (right): https://codereview.chromium.org/218953002/diff/1/Source/bindings/v8/WorkerScriptController.cpp#newcode113 Source/bindings/v8/WorkerScriptController.cpp:113: // (3) ThreadState::detach() On 2014/03/31 06:33:10, zerny-chromium wrote: > ...
6 years, 8 months ago (2014-03-31 08:56:52 UTC) #4
haraken
Thanks for comments! Actually I've not yet found a solution that makes perfect sense to ...
6 years, 8 months ago (2014-03-31 09:16:34 UTC) #5
Mads Ager (chromium)
On 2014/03/31 09:16:34, haraken wrote: > Thanks for comments! Actually I've not yet found a ...
6 years, 8 months ago (2014-03-31 09:30:17 UTC) #6
haraken
On 2014/03/31 09:30:17, Mads Ager (chromium) wrote: > On 2014/03/31 09:16:34, haraken wrote: > > ...
6 years, 8 months ago (2014-03-31 09:33:05 UTC) #7
haraken
Mads: > Can we reuse ContextLifecycleObserver for this? When the worker context is going > ...
6 years, 8 months ago (2014-04-01 05:56:13 UTC) #8
haraken
> performing a full garbage collection on all threads in order to invalidate the > ...
6 years, 8 months ago (2014-04-01 06:08:03 UTC) #9
Mads Ager (chromium)
https://codereview.chromium.org/218953002/diff/20001/Source/core/workers/WorkerGlobalScope.cpp File Source/core/workers/WorkerGlobalScope.cpp (right): https://codereview.chromium.org/218953002/diff/20001/Source/core/workers/WorkerGlobalScope.cpp#newcode203 Source/core/workers/WorkerGlobalScope.cpp:203: clearScript(); On 2014/04/01 05:56:14, haraken wrote: > > I'm ...
6 years, 8 months ago (2014-04-01 11:38:37 UTC) #10
Mads Ager (chromium)
On 2014/04/01 06:08:03, haraken wrote: > > performing a full garbage collection on all threads ...
6 years, 8 months ago (2014-04-01 11:43:00 UTC) #11
haraken
On 2014/04/01 11:38:37, Mads Ager (chromium) wrote: > https://codereview.chromium.org/218953002/diff/20001/Source/core/workers/WorkerGlobalScope.cpp > File Source/core/workers/WorkerGlobalScope.cpp (right): > > ...
6 years, 8 months ago (2014-04-01 14:38:05 UTC) #12
haraken
+sof who knows a lot about worker thread destruction :)
6 years, 8 months ago (2014-04-01 14:54:15 UTC) #13
sof
On 2014/04/01 14:54:15, haraken wrote: > +sof who knows a lot about worker thread destruction ...
6 years, 8 months ago (2014-04-01 16:07:46 UTC) #14
sof
On 2014/04/01 16:07:46, sof wrote: > On 2014/04/01 14:54:15, haraken wrote: > > +sof who ...
6 years, 8 months ago (2014-04-01 20:08:54 UTC) #15
haraken
On 2014/04/01 20:08:54, sof wrote: > On 2014/04/01 16:07:46, sof wrote: > > On 2014/04/01 ...
6 years, 8 months ago (2014-04-02 01:31:04 UTC) #16
haraken
mads@: Updated a CL. I think a right fix to this issue would be just ...
6 years, 8 months ago (2014-04-11 01:28:26 UTC) #17
haraken
I confirmed that this CL fixes all flaky crashes in IDB tests in oilpan builds.
6 years, 8 months ago (2014-04-11 01:29:23 UTC) #18
sof
That cuts a knot. I cannot see an unsafe use of m_result that would result ...
6 years, 8 months ago (2014-04-11 06:24:39 UTC) #19
Mads Ager (chromium)
On 2014/04/11 01:28:26, haraken wrote: > mads@: Updated a CL. I think a right fix ...
6 years, 8 months ago (2014-04-11 06:32:03 UTC) #20
jsbell
lgtm I'm glad I was in meetings and didn't see the churn on this. :) ...
6 years, 8 months ago (2014-04-11 16:34:21 UTC) #21
haraken
On 2014/04/11 16:34:21, jsbell wrote: > lgtm > > I'm glad I was in meetings ...
6 years, 8 months ago (2014-04-11 16:38:59 UTC) #22
haraken
The CQ bit was checked by haraken@chromium.org
6 years, 8 months ago (2014-04-11 16:39:04 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/218953002/30001
6 years, 8 months ago (2014-04-11 16:39:15 UTC) #24
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-11 17:11:59 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.blink on linux_blink_rel
6 years, 8 months ago (2014-04-11 17:12:00 UTC) #26
haraken
hmm, the CL breaks a couple of IDB tests... The issue is as follows: (1) ...
6 years, 8 months ago (2014-04-14 04:04:21 UTC) #27
jsbell
What's the status of this CL? I seem to recall that some work was done ...
6 years, 4 months ago (2014-08-11 22:52:31 UTC) #28
haraken
On 2014/08/11 22:52:31, jsbell wrote: > What's the status of this CL? I seem to ...
6 years, 4 months ago (2014-08-12 01:04:19 UTC) #29
haraken
6 years, 4 months ago (2014-08-12 01:04:53 UTC) #30
Message was sent while issue was closed.
On 2014/08/12 01:04:19, haraken wrote:
> On 2014/08/11 22:52:31, jsbell wrote:
> > What's the status of this CL? I seem to recall that some work was done to
> > handling modification of the ActiveDOMObject list during iteration, but did
> > enough happen to unblock this change, and/or did this get rethought?
> 
> This issue is gone, since IDBRequest::checkForReferenceCycle() is gone when
> Oilpan was enabled by default for indexeddb/.

Closing the issue.

Powered by Google App Engine
This is Rietveld 408576698