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

Issue 640853008: Sync: Avoid deadlock in SyncBackendRegistrar / ModelSafeWorker on sync backend shutdown. (Closed)

Created:
6 years, 2 months ago by stanisc
Modified:
6 years, 1 month ago
Reviewers:
Nicolas Zea
CC:
chromium-reviews, tim+watch_chromium.org, zea+watch_chromium.org, pvalenzuela+watch_chromium.org, gcasto+watchlist_chromium.org, mkwst+watchlist_chromium.org, maniscalco+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Sync: Avoid deadlock in SyncBackendRegistrar / ModelSafeWorker on sync backend shutdown. This is a resubmit of the previous fix that has been reverted due to the flaky unittest that would hang under the load: https://codereview.chromium.org/637413003 Please see delta between patch sets 1 and 2 for the unit test fix. The test would hang due to a race condition between MessageLoop::RunUntilIdle call for the main UI thread and submitting a task on the UI thread from SyncBackendRegistrar running on the sync thread. The new test implementation runs the UI thread loop continuously until the expected result is reached so that eliminates the race condition and makes the test simpler. I verified the fix by running the test while running Chromium build in background. Using this method I reliably reproduced the hang with the first implementation of the test. This version of the test works reliably under the same condition. BUG=423078 Committed: https://crrev.com/df486a3cbdad2025fff98fa497edb1261e83435c Cr-Commit-Position: refs/heads/master@{#301056}

Patch Set 1 #

Patch Set 2 : Fixed hang in the unit test #

Total comments: 2

Patch Set 3 : Use RunLoop instead of deprecated MessageLoop::Run in the test. #

Patch Set 4 : Addressed CR feedback and verified under valgrind #

Total comments: 8

Patch Set 5 : Addressed second round of CR feedback #

Patch Set 6 : Fixed linux_clang_tsan warning about lock-order-inversion #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -26 lines) Patch
M chrome/browser/sync/glue/browser_thread_model_worker.cc View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/sync/glue/history_model_worker.cc View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/sync/glue/password_model_worker.cc View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/sync/glue/sync_backend_registrar_unittest.cc View 1 2 3 4 5 2 chunks +91 lines, -0 lines 0 comments Download
M chrome/browser/sync/glue/ui_model_worker.cc View 1 chunk +0 lines, -1 line 0 comments Download
M sync/internal_api/public/engine/model_safe_worker.h View 1 chunk +7 lines, -1 line 0 comments Download
M sync/internal_api/public/engine/model_safe_worker.cc View 1 2 3 4 5 2 chunks +45 lines, -20 lines 0 comments Download
M sync/internal_api/public/engine/passive_model_worker.cc View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 10 (2 generated)
stanisc
Please review. This is pretty much the same as the previous patch that you've already ...
6 years, 2 months ago (2014-10-22 05:39:36 UTC) #2
Nicolas Zea
https://codereview.chromium.org/640853008/diff/20001/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc File chrome/browser/sync/glue/sync_backend_registrar_unittest.cc (right): https://codereview.chromium.org/640853008/diff/20001/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc#newcode336 chrome/browser/sync/glue/sync_backend_registrar_unittest.cc:336: base::MessageLoop::current()->Run(); nit: Run() is deprecated. The preferred approach these ...
6 years, 2 months ago (2014-10-22 17:06:44 UTC) #3
stanisc
Please see the updated version of the test that uses RunLoop. I couldn't get a ...
6 years, 1 month ago (2014-10-23 17:51:13 UTC) #4
Nicolas Zea
LGTM with some nits https://codereview.chromium.org/640853008/diff/60001/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc File chrome/browser/sync/glue/sync_backend_registrar_unittest.cc (right): https://codereview.chromium.org/640853008/diff/60001/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc#newcode281 chrome/browser/sync/glue/sync_backend_registrar_unittest.cc:281: base::AutoLock l(lock_); given that you ...
6 years, 1 month ago (2014-10-23 18:07:17 UTC) #5
stanisc
https://codereview.chromium.org/640853008/diff/60001/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc File chrome/browser/sync/glue/sync_backend_registrar_unittest.cc (right): https://codereview.chromium.org/640853008/diff/60001/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc#newcode281 chrome/browser/sync/glue/sync_backend_registrar_unittest.cc:281: base::AutoLock l(lock_); On 2014/10/23 18:07:16, Nicolas Zea wrote: > ...
6 years, 1 month ago (2014-10-23 19:21:57 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/640853008/100001
6 years, 1 month ago (2014-10-24 04:37:59 UTC) #8
commit-bot: I haz the power
Committed patchset #6 (id:100001)
6 years, 1 month ago (2014-10-24 05:17:56 UTC) #9
commit-bot: I haz the power
6 years, 1 month ago (2014-10-24 05:18:46 UTC) #10
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/df486a3cbdad2025fff98fa497edb1261e83435c
Cr-Commit-Position: refs/heads/master@{#301056}

Powered by Google App Engine
This is Rietveld 408576698