Commit ebdf7bee authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

TaskScheduler: Do not limit the number of BLOCK_SHUTDOWN tasks posted during shutdown.

There is currently a CHECK that no more than 1000 BLOCK_SHUTDOWN tasks
are posted during shutdown. The goal of this CHECK is to prevent
shutdown hangs caused by components that behave badly (e.g. a component
that reposts a BLOCK_SHUTDOWN task at the end of each BLOCK_SHUTDOWN
task).

This CL removes this CHECK because:
- It is redundant with the hang watcher.
- Unlike the failures reported by the hang watcher, the failures
  reported by this CHECK aren't necessarily associated with user pain
  (e.g. posting more than 1000 very short BLOCK_SHUTDOWN tasks during
  shutdown will probably not be noticed by the user if it doesn't
  trigger the hang watcher).

Bug: 897334
Change-Id: I6c0ce508c5bd892724a92add3025afe9019a35e7
Reviewed-on: https://chromium-review.googlesource.com/c/1318173Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605461}
parent da0109e9
...@@ -133,12 +133,6 @@ HistogramBase* GetHistogramForTaskTraits( ...@@ -133,12 +133,6 @@ HistogramBase* GetHistogramForTaskTraits(
: 0]; : 0];
} }
// Maximum number of BLOCK_SHUTDOWN tasks that can be posted during shutdown. If
// that many BLOCK_SHUTDOWN tasks are posted during shutdown, it is possible
// that buggy code is posting an infinite number of tasks and that shutdown will
// never complete. The mitigation is to induce a crash.
constexpr int kMaxBlockShutdownTasksPostedDuringShutdown = 1000;
// Returns the maximum number of TaskPriority::BEST_EFFORT sequences that can be // Returns the maximum number of TaskPriority::BEST_EFFORT sequences that can be
// scheduled concurrently based on command line flags. // scheduled concurrently based on command line flags.
int GetMaxNumScheduledBestEffortSequences() { int GetMaxNumScheduledBestEffortSequences() {
...@@ -663,7 +657,6 @@ void TaskTracker::PerformShutdown() { ...@@ -663,7 +657,6 @@ void TaskTracker::PerformShutdown() {
// This method can only be called once. // This method can only be called once.
DCHECK(!shutdown_event_); DCHECK(!shutdown_event_);
DCHECK(!num_block_shutdown_tasks_posted_during_shutdown_);
DCHECK(!state_->HasShutdownStarted()); DCHECK(!state_->HasShutdownStarted());
shutdown_event_ = std::make_unique<WaitableEvent>(); shutdown_event_ = std::make_unique<WaitableEvent>();
...@@ -783,10 +776,6 @@ bool TaskTracker::BeforePostTask( ...@@ -783,10 +776,6 @@ bool TaskTracker::BeforePostTask(
state_->DecrementNumTasksBlockingShutdown(); state_->DecrementNumTasksBlockingShutdown();
return false; return false;
} }
++num_block_shutdown_tasks_posted_during_shutdown_;
CHECK_LT(num_block_shutdown_tasks_posted_during_shutdown_,
kMaxBlockShutdownTasksPostedDuringShutdown);
} }
return true; return true;
......
...@@ -396,9 +396,6 @@ class BASE_EXPORT TaskTracker { ...@@ -396,9 +396,6 @@ class BASE_EXPORT TaskTracker {
bool execution_fence_enabled_ = false; bool execution_fence_enabled_ = false;
#endif #endif
// Number of BLOCK_SHUTDOWN tasks posted during shutdown.
HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0;
// Enforces that |max_scheduled_sequences| and // Enforces that |max_scheduled_sequences| and
// |max_scheduled_sequences_before_fence| in PreemptedState are only written // |max_scheduled_sequences_before_fence| in PreemptedState are only written
// on the main sequence (determined by the first call to // on the main sequence (determined by the first call to
......
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