Commit ecf01bd0 authored by tim@chromium.org's avatar tim@chromium.org

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
parent 9dfab49a
...@@ -316,6 +316,7 @@ bool SyncSchedulerImpl::ScheduleConfiguration( ...@@ -316,6 +316,7 @@ bool SyncSchedulerImpl::ScheduleConfiguration(
DCHECK(IsConfigRelatedUpdateSourceValue(params.source)); DCHECK(IsConfigRelatedUpdateSourceValue(params.source));
DCHECK_EQ(CONFIGURATION_MODE, mode_); DCHECK_EQ(CONFIGURATION_MODE, mode_);
DCHECK(!params.ready_task.is_null()); DCHECK(!params.ready_task.is_null());
CHECK(started_) << "Scheduler must be running to configure.";
SDVLOG(2) << "Reconfiguring syncer."; SDVLOG(2) << "Reconfiguring syncer.";
// Only one configuration is allowed at a time. Verify we're not waiting // Only one configuration is allowed at a time. Verify we're not waiting
...@@ -594,6 +595,12 @@ void SyncSchedulerImpl::ScheduleNudgeImpl( ...@@ -594,6 +595,12 @@ void SyncSchedulerImpl::ScheduleNudgeImpl(
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
DCHECK(!invalidation_map.empty()) << "Nudge scheduled for no types!"; 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) SDVLOG_LOC(nudge_location, 2)
<< "In ScheduleNudgeImpl with delay " << "In ScheduleNudgeImpl with delay "
<< delay.InMilliseconds() << " ms, " << delay.InMilliseconds() << " ms, "
...@@ -992,6 +999,8 @@ void SyncSchedulerImpl::StopImpl(const base::Closure& callback) { ...@@ -992,6 +999,8 @@ void SyncSchedulerImpl::StopImpl(const base::Closure& callback) {
weak_ptr_factory_.InvalidateWeakPtrs(); weak_ptr_factory_.InvalidateWeakPtrs();
wait_interval_.reset(); wait_interval_.reset();
poll_timer_.Stop(); poll_timer_.Stop();
unscheduled_nudge_storage_.reset();
pending_nudge_ = NULL;
if (started_) { if (started_) {
started_ = false; started_ = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment