Open Bug 1764420 Opened 2 years ago Updated 3 months ago

Intermittent FATAL ERROR: AsyncShutdown timeout in IOUtils: waiting for profileBeforeChange IO to complete Conditions: [{"name":"CrashMonitor: Writing notifications to file after receiving profile-before-change and awaiting all checkpoints written","state

Categories

(Toolkit :: Crash Reporting, defect)

defect

Tracking

()

People

(Reporter: whimboo, Unassigned)

References

(Blocks 1 open bug)

Details

I've seen this shutdown hang and crash today while working on a patch for bug 1759169 which runs the initialization of our Remote Agent (CDP and WebDriver BiDi) quite a lot earlier during startup. As such CDP clients could also shutdown the browser before sessionstore has been finished.

Here a try build:

https://treeherder.mozilla.org/jobs?repo=try&revision=bb1ec799634ffeaf1dab7999a3879b5b055f95bd&selectedTaskRun=TPsjrpYhQ-ip6cAtDdHEyA.0

[task 2022-04-12T15:12:02.852Z] PID 409 | WARNING: At least one completion condition is taking too long to complete. Conditions: [{"name":"CrashMonitor: Writing notifications to file after receiving profile-before-change and awaiting all checkpoints written","state":{"profile-after-change":true,"final-ui-startup":true,"quit-application-granted":true,"sessionstore-windows-restored":true,"quit-application":true,"profile-change-net-teardown":true,"profile-change-teardown":true,"profile-before-change":true},"filename":"resource://gre/modules/CrashMonitor.jsm","lineNumber":175,"stack":["resource://gre/modules/CrashMonitor.jsm:init:175","resource://gre/modules/nsCrashMonitor.jsm:observe:19"]}] Barrier: IOUtils: waiting for profileBeforeChange IO to complete
[task 2022-04-12T15:12:02.853Z] PID 409 | WARNING: At least one completion condition is taking too long to complete. Conditions: [{"name":"IOUtils Blocker (profile-before-change)","state":"(none)","filename":"/builds/worker/checkouts/gecko/dom/system/IOUtils.cpp","lineNumber":1898,"stack":"IOUtils::EventQueue::SetShutdownHooks"}] Barrier: profile-before-change

As discussed with Barret this should basically not happen and would have to be fixed.

This shutdown hang can be reproduce without involving RemoteAgent, simply by quitting very early a Firefox started with a temp-profile

I suggest to first disable the "confirm on shutdown behavior". Replace https://searchfox.org/mozilla-central/rev/d34f9713ae128a3138c2b70d8041a535f1049d19/browser/components/BrowserGlue.jsm#2963-2965 with let shouldWarnForShortcut = false;.

You can reproduce the issue without doing this, but it's just more tricky, because it requires you to both press ctrl/cmd+Q and then right after accept the confirm with Enter.

The STRs are then

  • run ./mach run --temp-profile
  • wait for the application to start (eg in macos, when you see Nightly in the top menu
  • press the quit shortcut

You don't have to be "extremely" fast, but on my machine I need to do it within the first second to get the hang.

The content of the logs varies depends on your timing, on the last few logs are consistent:

JavaScript error: resource://gre/modules/TerminatorTelemetry.jsm, line 71: AbortError: IOUtils: Shutting down and refusing additional I/O tasks
JavaScript error: resource://gre/modules/CrashManager.jsm, line 898: AbortError: IOUtils: Shutting down and refusing additional I/O tasks
RunWatchdog: Mainthread nested event loops during hang: 
 --- (no nested event loop active) 

I actually can also reproduce with ./mach run, so without forcing a --temp-profile

The severity field is not set for this bug.
:gsvelto, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(gsvelto)
Severity: -- → S3
Flags: needinfo?(gsvelto)
Blocks: 1758634
Duplicate of this bug: 1872331
You need to log in before you can comment on or make changes to this bug.