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

Issue 7847010: Fix WaitForTypeEncryption race condition (Closed)

Created:
9 years, 3 months ago by rlarocque
Modified:
9 years, 3 months ago
CC:
chromium-reviews, Raghu Simha, ncarter (slow), tim (not reviewing), idana
Visibility:
Public.

Description

Fix WaitForTypeEncryption race condition IsTypeEncrypted() and IsSynced() are both changed when by a WriteTransaction on the syncer thread. When IsTypeEncrytped() gets toggled from false to true, that should imply that IsSynced() is false (at least until a sync cycle comes along and commits the changes to the server). Sometimes the thread executing this code will see the value of IsSynced() before the transaction (true) and IsTypeEncrypted after the transaction (true). This is bad, because we end up inside the if branch when IsSynced() is false, which is not the intent of this code. A proper fix might involve wrapping the entire if condition in a ReadTrasaction. An easier fix is to swap the order in which the conditions are evaluated, and that's what this commit does. BUG=95619 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=100186

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M chrome/browser/sync/profile_sync_service_harness.cc View 1 chunk +2 lines, -2 lines 2 comments Download

Messages

Total messages: 7 (0 generated)
rlarocque
Looking for review of this change. It looks like a no-op, but it actually prevents ...
9 years, 3 months ago (2011-09-08 17:39:54 UTC) #1
Nicolas Zea
LGTM.
9 years, 3 months ago (2011-09-08 17:50:57 UTC) #2
commit-bot: I haz the power
Presubmit check for 7847010-1 failed and returned exit status 1. Running presubmit commit checks ...
9 years, 3 months ago (2011-09-08 17:52:54 UTC) #3
Nicolas Zea
It's a false positive, I would just commit manually. On Thu, Sep 8, 2011 at ...
9 years, 3 months ago (2011-09-08 17:59:09 UTC) #4
rlarocque1
Already done. On Thu, Sep 8, 2011 at 10:59, Nicolas Zea <zea@chromium.org> wrote: > It's ...
9 years, 3 months ago (2011-09-08 18:01:26 UTC) #5
akalin
You already check this in, but can you address the comments in a separate CL? ...
9 years, 3 months ago (2011-09-22 18:12:05 UTC) #6
rlarocque
9 years, 3 months ago (2011-09-22 19:05:57 UTC) #7
You bring up a good point.  Thanks for reminding me about this.  

I wasn't sure if it was possible to reuse this code review for the new commit,
so I've started a new one.  See http://codereview.chromium.org/7995015.

http://codereview.chromium.org/7847010/diff/1/chrome/browser/sync/profile_syn...
File chrome/browser/sync/profile_sync_service_harness.cc (right):

http://codereview.chromium.org/7847010/diff/1/chrome/browser/sync/profile_syn...
chrome/browser/sync/profile_sync_service_harness.cc:1005: if
(IsTypeEncrypted(type) &&
On 2011/09/22 18:12:05, akalin wrote:
> Can you add a comment for this?  This can easily be unknowingly reverted.
> 
> Also, maybe a TODO to figure out a better way to do this.

Done.

Powered by Google App Engine
This is Rietveld 408576698