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

Issue 335823002: [oilpan]: RFC: Change DatabaseBackendBase::performOpenAndVerify locking (Closed)

Created:
6 years, 6 months ago by wibling-chromium
Modified:
5 years, 8 months ago
CC:
blink-reviews
Project:
blink
Visibility:
Public.

Description

[oilpan]: RFC: Change DatabaseBackendBase::performOpenAndVerify locking This is a request for comment and should not necessarily be commited. When looking at the timeout in the terminate-during-sync-operation-websql.html test I found that we are holding a global lock (guidMutex) while doing sync database operations. The tests starts multiple threads all of which try to open the database. One thread gets the lock and the remaining will block waiting for the lock. None of these threads are in a safepoint at this point. I cannot add a safepoint scope at this point since the code will do allocations. Instead what I have tried is to release the lock while doing the database operations. This does mean multiple threads might end up trying to create the info table, but I have changed the code so only one of them get to commit the transaction to be as close to the previous semantic as possible. I should mention that all the waiting threads might not be in performOpenAndVerify, but common is that they are all waiting on the guidMutex which is taken in other methods. Basically any thread taking the guidMutex can block other threads progress since it is a global lock. Doing a sync operation while holding this lock is as such not a good idea. This change does make the test work without timing out. R=ager@chromium.org, erik.corry@gmail.com, haraken@chromium.org, oilpan-reviews@chromium.org, tkent@chromium.org, vegorov@chromium.org, zerny@chromium.org, kinuko@chromium.org, morrita@chromium.org BUG=375671

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -8 lines) Patch
M Source/modules/webdatabase/DatabaseBackendBase.cpp View 3 chunks +27 lines, -6 lines 1 comment 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

Messages

Total messages: 5 (0 generated)
wibling-chromium
6 years, 6 months ago (2014-06-13 12:40:14 UTC) #1
Vyacheslav Egorov (Google)
https://codereview.chromium.org/335823002/diff/1/Source/modules/webdatabase/DatabaseBackendBase.cpp File Source/modules/webdatabase/DatabaseBackendBase.cpp (left): https://codereview.chromium.org/335823002/diff/1/Source/modules/webdatabase/DatabaseBackendBase.cpp#oldcode332 Source/modules/webdatabase/DatabaseBackendBase.cpp:332: MutexLocker locker(guidMutex()); An alternative less intrusive approach would be ...
6 years, 6 months ago (2014-06-13 12:49:40 UTC) #2
wibling-chromium
On 2014/06/13 12:49:40, Vyacheslav Egorov (Google) wrote: > https://codereview.chromium.org/335823002/diff/1/Source/modules/webdatabase/DatabaseBackendBase.cpp > File Source/modules/webdatabase/DatabaseBackendBase.cpp (left): > > ...
6 years, 6 months ago (2014-06-13 13:03:12 UTC) #3
haraken
Slava's idea sounds great to me. I also agree with Gustav that we should refactor ...
6 years, 6 months ago (2014-06-13 14:37:14 UTC) #4
tkent
6 years, 6 months ago (2014-06-16 00:03:26 UTC) #5
wibling@, thank you for the investigation and proposing a fix!

I agree with the SafePointAwareMutex idea.  IMO, improving Web Database code is
not worth to do because it's a dying feature.

Powered by Google App Engine
This is Rietveld 408576698