Closed Bug 2062988 Opened 3 months ago Closed 3 months ago

Startup hangs instead of exiting when profile selection fails in headless mode

Categories

(Toolkit :: Startup and Profile System, defect)

defect

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: spohl, Assigned: spohl)

References

Details

Attachments

(1 external file)

ProfileMissingDialog() in toolkit/xre/nsAppRunner.cpp puts up a modal alert through nsIPromptService::Alert(). Nothing can dismiss a modal in headless mode, so a failure to select a profile leaves the parent process spinning in AppWindow::ShowModal() rather than exiting with an error. ProfileEncryptionMismatchDialog() in the same file looks like it has the same problem.

ProfileLockedDialog() already checks gfxPlatform::IsHeadless() and writes to stderr instead, so this appears to be an oversight rather than a deliberate difference.

This does not look platform-specific. Any profile-selection failure under -headless or -screenshot should be able to reach it.

It was found through bug 2060476, where on macOS 27 the app data directory cannot be read when Firefox is started by direct exec instead of through LaunchServices, so profile selection fails. A sample of the hung process showed:

XREMain::XRE_mainStartup
  ProfileMissingDialog(nsINativeAppSupport*)
    nsWindowWatcher::OpenWindow
      mozilla::AppWindow::ShowModal
        NS_ProcessNextEvent ... spinning

A harness cannot tell it apart from a slow startup, so it waits out its timeout with no diagnostic in the log, which is part of what made bug 2060476 expensive to investigate.

Expected: report the failure on stderr and exit non-zero, the way ProfileLockedDialog() already does in headless mode.

A patch adding the check to both functions has been verified on macOS 27 in bug 2060476 comment 9. The launch that previously hung now prints Could not find profile folder. and exits 1.

ProfileMissingDialog() and ProfileEncryptionMismatchDialog() put up a modal alert. Nothing can dismiss a modal in headless mode, so a failure to select a profile turns into an indefinite hang in AppWindow::ShowModal() rather than an error exit. ProfileLockedDialog() already prints to stderr and returns in that case, so do the same in these two.

This does not change what makes profile selection fail, only how the failure is reported.

Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
QA Whiteboard: [qa-triage-done-c156/b155]
See Also: → 2069767
See Also: → 2094487
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: