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

Issue 332393002: [oilpan]: Add SafePointAwareMutexLocker to allow GC when waiting for lock. (Closed)

Created:
6 years, 6 months ago by wibling-chromium
Modified:
6 years, 6 months ago
CC:
blink-reviews, haraken, kouhei+heap_chromium.org, Mads Ager (chromium)
Project:
blink
Visibility:
Public.

Description

[oilpan]: Add SafePointAwareMutexLocker to allow GC when waiting for lock. This change add a mutex locker which enters a safepoint while trying to acquire the mutex lock. This means that threads waiting to acquire a lock would be parked allowing a GC. In addition to entering a safepoint the locker will also ensure that if we block while leaving the safepoint, due to another thread having scheduled a GC, the lock will be released and the safepoint reentered. This allows for the lock to be acquired during sweeping, specifically in weak processing and finalization which could otherwise deadlock and cause the other scheduled GC to time out. This change does however not fix the issue where the lock has been acquired and another safepoint is entered while having the lock. This could still cause a timeout. There is an instance of this scenario in the webdatabase's DatabaseBackendBase.cpp::performOpenAndVerify where we get the guidMutex and while commiting the transaction enter a safepoint in the SQLiteStatement::prepare and SQLiteStatement::step calls. To fix the above we have to restructure the webdatabase code to not hold the global guidMutex lock while doing sync operations. This change does make it less likely that we hit the empty assert in the terminate-during-sync-websql.html test, but due to the above issue it can still happen. We should consider still doing the restructuring in https://codereview.chromium.org/335823002/ to completely get rid of the flakiness. R=ager@chromium.org, erik.corry@gmail.com, haraken@chromium.org, oilpan-reviews@chromium.org, tkent@chromium.org, vegorov@chromium.org, zerny@chromium.org BUG=375671 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176347

Patch Set 1 #

Total comments: 17

Patch Set 2 : review feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+79 lines, -14 lines) Patch
M Source/modules/webdatabase/DatabaseBackendBase.cpp View 4 chunks +5 lines, -5 lines 0 comments Download
M Source/modules/webdatabase/sqlite/SQLiteFileSystem.cpp View 2 chunks +2 lines, -0 lines 0 comments Download
M Source/modules/webdatabase/sqlite/SQLiteStatement.cpp View 2 chunks +4 lines, -2 lines 0 comments Download
M Source/platform/heap/ThreadState.h View 1 4 chunks +52 lines, -1 line 0 comments Download
M Source/platform/heap/ThreadState.cpp View 1 5 chunks +16 lines, -6 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
wibling-chromium
6 years, 6 months ago (2014-06-17 10:49:25 UTC) #1
zerny-chromium
lgtm https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.h File Source/platform/heap/ThreadState.h (right): https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.h#newcode610 Source/platform/heap/ThreadState.h:610: // SafePointBarrier::checkAndPark. Nits: The SafePointAwareMutexLocker is -> SafePointAwareMutexLocker ...
6 years, 6 months ago (2014-06-17 11:12:56 UTC) #2
Mads Ager (chromium)
LGTM https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp File Source/platform/heap/ThreadState.cpp (right): https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp#newcode195 Source/platform/heap/ThreadState.cpp:195: // lock to be acquired in the sweep ...
6 years, 6 months ago (2014-06-17 11:57:19 UTC) #3
wibling-chromium
Thanks for the reviews! I have updated the diff accordingly. https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp File Source/platform/heap/ThreadState.cpp (right): https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp#newcode195 ...
6 years, 6 months ago (2014-06-17 12:06:41 UTC) #4
haraken
This is a nice change! LGTM. Just to confirm: Can (or should) we replace all ...
6 years, 6 months ago (2014-06-17 12:25:41 UTC) #5
wibling-chromium
On 2014/06/17 12:25:41, haraken wrote: > This is a nice change! LGTM. > > Just ...
6 years, 6 months ago (2014-06-17 12:38:10 UTC) #6
wibling-chromium
Thanks for the review! https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp File Source/platform/heap/ThreadState.cpp (right): https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp#newcode189 Source/platform/heap/ThreadState.cpp:189: void checkAndPark(ThreadState* state, SafePointAwareMutexLocker* locker ...
6 years, 6 months ago (2014-06-17 12:38:21 UTC) #7
wibling-chromium
The CQ bit was checked by wibling@chromium.org
6 years, 6 months ago (2014-06-17 14:21:13 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wibling@chromium.org/332393002/20001
6 years, 6 months ago (2014-06-17 14:21:56 UTC) #9
haraken
https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp File Source/platform/heap/ThreadState.cpp (right): https://codereview.chromium.org/332393002/diff/1/Source/platform/heap/ThreadState.cpp#newcode755 Source/platform/heap/ThreadState.cpp:755: ASSERT(!m_atSafePoint); On 2014/06/17 12:38:21, wibling-chromium wrote: > On 2014/06/17 ...
6 years, 6 months ago (2014-06-17 14:25:36 UTC) #10
commit-bot: I haz the power
6 years, 6 months ago (2014-06-17 19:21:30 UTC) #11
Message was sent while issue was closed.
Change committed as 176347

Powered by Google App Engine
This is Rietveld 408576698