Skip to content

smoke: fail fast with actionable error when Electron crashes during launch - #322905

Merged
Alexandru Dima (alexdima) merged 3 commits into
mainfrom
agents/investigate-flaky-smoke-test-logs-f948ca42
Jun 25, 2026
Merged

Alexandru Dima (alexdima) merged 3 commits into
mainfrom
agents/investigate-flaky-smoke-test-logs-f948ca42

Conversation

@alexdima

Copy link
Copy Markdown
Member

What

The per-suite before all hook in the Electron smoke tests launches Electron via Playwright's _electron.launch. It was called with timeout: 0 (no timeout), and the first-window wait used timeout: 0 too.

This PR gives both the launch and the first-window wait a finite timeout (LAUNCH_TIMEOUT = 60s, well below Mocha's 120s before all hook timeout) and wraps them so a failure is re-thrown as an actionable error that points at the crash-dump directory and the Playwright trace.

Why

Investigating a flaky smoke-test failure (run 28140700565, Linux / Electron-Smoke):

1) VSCode Smoke Tests (Electron)
     Search
       "before all" hook for "verifies the sidebar moves to the right":
     Error: Timeout of 120000ms exceeded.

Root cause from the artifacts:

  • The before all hook started playwright-electron#launch and then went completely silent for 120s (no Electron stdout at all), while the next suite launched normally in ~800ms.
  • The crash-dump artifact contains a minidump for the 8_suite_Search launch (pending/…dmp), timestamped ~1s after the launch was spawned: SIGSEGV (exception code 0xb) in the Electron main/browser process, in the Chromium sandbox startup path (sandbox_ipc_linux.cc, network_sandbox.cc, namespace_sandbox.cc).

Because _electron.launch was called with timeout: 0, the crash never surfaced as a launch failure — the promise just hung until Mocha killed the hook at 120s, producing an opaque timeout with no hint that a native crash had occurred. This also explains why the same 120000ms timeout shows up across many different suites' before all hooks: the underlying native launch crash is suite-independent and rare, so it lands on whichever suite happens to be starting.

Notes for reviewers

  • This makes the harness fail fast (~60s instead of 120s) and diagnosably (error message references the crash-dump dir + trace). It does not add a launch retry — that can be a follow-up.
  • The underlying Electron/Chromium startup crash itself is being investigated separately; this PR is about no longer masking it behind a generic Mocha hook timeout.
  • Could not run the repo hygiene/compile tasks locally (node_modules not installed in this worktree); the change is isolated to test/automation and was transpile-checked in isolation.

Co-authored-by: Copilot [email protected]

…aunch

The per-suite `before all` hook launches Electron via Playwright's
`_electron.launch`. This was called with `timeout: 0`, so when the
Electron process crashed during startup (e.g. a native SIGSEGV in the
Chromium browser-process/sandbox init path, which leaves a minidump),
the launch promise never resolved or rejected. It simply hung until
Mocha's 120s `before all` hook timeout fired, producing an opaque
"Timeout of 120000ms exceeded" with no hint that a native crash had
occurred.

Give the launch (and the first-window wait) a finite timeout well below
the Mocha hook timeout and wrap them so a failure is re-thrown as an
actionable error pointing at the crash-dump directory and Playwright
trace. This turns a 120s opaque hang into a faster, clearly-diagnosable
failure.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 25, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Electron smoke-test harness by adding finite timeouts around Playwright Electron launch and first-window acquisition, and by rethrowing failures with a more actionable diagnostic message (crash-dump directory + Playwright trace guidance) instead of letting Mocha’s before all hook time out opaquely.

Changes:

  • Introduce a 60s LAUNCH_TIMEOUT for _electron.launch and the initial waitForEvent('window').
  • Wrap launch and first-window waits in try/catch and rethrow via enrichLaunchError(...) for more actionable failures.
  • Add an enrichLaunchError helper that logs and provides crash/trace pointers.
Show a summary per file
File Description
test/automation/src/playwrightElectron.ts Add bounded launch/window timeouts and enrich failures with actionable diagnostics to avoid opaque Mocha hook timeouts.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants