Files
sousa-gecko/xpcom/threads
Stephen A Pohl 001a1d75c8 Bug 2035706: Stop IdleTaskRunner from rescheduling once thread shutdown has begun. r=xpcom-reviewers,jstutte,nika,yjuglaret
During content-process shutdown an IdleTaskRunner can re-dispatch itself through immediate idle dispatch (Run -> Schedule -> TaskController::AddTask -> Run ...). The shutdown event-loop drains in ShutdownXPCOM and nsThreadManager::ShutdownNonMainThreads keep running that task while the idle deadline is stale, so it reschedules right away and spins the main thread. On macOS the parent's shutdown watchdog then force-crashes the still-busy child, which shows up in CI as the intermittent "application crashed [@ mach_msg2_trap]" signature and leakcheck "missing output line for total leaks!" failures on macOS 15 aarch64 debug, concentrated in the cross-origin variant that tears down many content processes.

Cancel the runner in Schedule() once we are in or beyond XPCOMShutdownThreads. Idle tasks are best-effort and serve no purpose that late in shutdown, and stopping them here prevents the runaway rescheduling that hangs the process.

Differential Revision: https://phabricator.services.mozilla.com/D310968
2026-07-14 14:41:48 +00:00
..