summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 00:42:42 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 00:42:42 +0000
commitecf01bd0d81a7869935372e7930a20fa2a190f4d (patch)
treecaa5f666ffd9bfb311a6af87ddfa4064feb7e546 /sync
parent9dfab49a3654c0c0394536ca12ea2e80081d8099 (diff)
downloadchromium_src-ecf01bd0d81a7869935372e7930a20fa2a190f4d.zip
chromium_src-ecf01bd0d81a7869935372e7930a20fa2a190f4d.tar.gz
chromium_src-ecf01bd0d81a7869935372e7930a20fa2a190f4d.tar.bz2
sync: speculative fix for bug 165561
The SyncManager will stop the scheduler as part of StopSyncingForShutdown, which happens well before things like the invalidator are torn down / told to stop interacting with the scheduler. As such, we can wind up scheduling nudges on a lame duck scheduler. Some of the stacks associated with 165561 clearly show browser shutdown happening on the UI thread and OnIncomingInvalidation happening on the sync thread, which will crash on a second invocation as pending_nudge will be set to a job that is dropped by ScheduleSyncSessionJob. BUG=165561 Review URL: https://chromiumcodereview.appspot.com/11827013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175945 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/engine/sync_scheduler_impl.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc
index 76a72f0..f07825e 100644
--- a/sync/engine/sync_scheduler_impl.cc
+++ b/sync/engine/sync_scheduler_impl.cc
@@ -316,6 +316,7 @@ bool SyncSchedulerImpl::ScheduleConfiguration(
DCHECK(IsConfigRelatedUpdateSourceValue(params.source));
DCHECK_EQ(CONFIGURATION_MODE, mode_);
DCHECK(!params.ready_task.is_null());
+ CHECK(started_) << "Scheduler must be running to configure.";
SDVLOG(2) << "Reconfiguring syncer.";
// Only one configuration is allowed at a time. Verify we're not waiting
@@ -594,6 +595,12 @@ void SyncSchedulerImpl::ScheduleNudgeImpl(
DCHECK_EQ(MessageLoop::current(), sync_loop_);
DCHECK(!invalidation_map.empty()) << "Nudge scheduled for no types!";
+ if (!started_) {
+ SDVLOG_LOC(nudge_location, 2)
+ << "Dropping nudge, scheduler is not running.";
+ return;
+ }
+
SDVLOG_LOC(nudge_location, 2)
<< "In ScheduleNudgeImpl with delay "
<< delay.InMilliseconds() << " ms, "
@@ -992,6 +999,8 @@ void SyncSchedulerImpl::StopImpl(const base::Closure& callback) {
weak_ptr_factory_.InvalidateWeakPtrs();
wait_interval_.reset();
poll_timer_.Stop();
+ unscheduled_nudge_storage_.reset();
+ pending_nudge_ = NULL;
if (started_) {
started_ = false;
}