Closed Bug 1192194 Opened 9 years ago Closed 9 years ago

DOMStorageDBThead::mDBReady should be atomic

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox42 --- affected
firefox43 --- fixed

People

(Reporter: mayhemer, Assigned: mayhemer)

Details

Attachments

(1 file)

It's read on two threads and block database update and main thread direct read concurrency.
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Attached patch v1Splinter Review
Attachment #8644916 - Flags: review?(bugs)
Comment on attachment 8644916 [details] [diff] [review]
v1

It is not clear to me whether this is enough.
DOMStorageDBThread::ShutdownDatabase() sets the value back to false, but what
if we have just executed
if (mDBReady && mWALModeEnabled) { in DOMStorageDBThread::SyncPreload.
Should we protect the stuff using a monitor?

But r+ to this change.
Attachment #8644916 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] (reviewing overload, please consider other reviewers) from comment #2)
> Comment on attachment 8644916 [details] [diff] [review]
> v1
> 
> It is not clear to me whether this is enough.
> DOMStorageDBThread::ShutdownDatabase() sets the value back to false, but what
> if we have just executed
> if (mDBReady && mWALModeEnabled) { in DOMStorageDBThread::SyncPreload.
> Should we protect the stuff using a monitor?
> 
> But r+ to this change.

nsresult
DOMStorageDBThread::ShutdownDatabase()
{
  // Has to be called on the worker thread.
  MOZ_ASSERT(!NS_IsMainThread());

  nsresult rv = mStatus;

  mDBReady = false;

  // Finalize the cached statements.
  mReaderStatements.FinalizeStatements();
  mWorkerStatements.FinalizeStatements();

  if (mReaderConnection) {
    // No need to sync access to mReaderConnection since the main thread
    // is right now joining this thread, unable to execute any events.

^^^^^
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f3d0fe2a731d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: