Skip to content

UncleanExit: Previous session ended without a clean exit (native crash) after ~480s on v1.29.3 #20

Closed

Description

@sentry

Sentry Issue: ELECTRON-D

UncleanExit: Previous session ended without a clean exit (native crash) after ~480s on v1.29.3
  File "app:///out/main/memoryHost.js", line 111, in recordUncleanExit
    const err = new Error(
  File "app:///out/main/index.js", line 11181, in Object.report
  File "app:///out/main/index.js", line 101, in initCrashWatch
    if (reported) d.report(reported);
  File "app:///out/main/index.js", line 11164

This issue was automatically created by Sentry via Auto-file Production crashes

Activity

  1. added
    bugSomething isn't working
    sentryAuto-created from Sentry crash report
    on Jul 21, 2026
  2. codedev-david commented on Jul 21, 2026

    @codedev-david
    Owner

    Auto-triage attempted but tests failed under the candidate fix. Human review needed. Log: C:\Users\DavidEngelhart\AppData\Local\termpolis\auto-triage\run-20260721-163423.log

  3. codedev-david commented on Jul 25, 2026

    @codedev-david
    Owner

    Fixed in v1.32.2 — this was a false positive in the crash detector, not a crash.

    The session it reported ran healthily for ~480s and then ended. There was no accompanying native crash report, because there was no native crash. What actually happened is that the app was shut down by something other than its own quit path.

    crashWatch writes a marker at boot and clears it on before-quit. That covers the exits we initiate — the user closing the window, Cmd/Alt+F4, app.quit(). It does not cover the exits the OS initiates:

    • a Windows session end (shutdown / restart / log off / taskkill)
    • a POSIX termination signal (SIGTERM, SIGINT, SIGHUP)

    In both cases the process dies with the marker still on disk, and the next launch reads it and reports a phantom native crash.

    Fix (c477566, 54ea1cd):

    • installCleanExitGuards() in src/main/crashWatch.ts marks a clean exit for an OS session end and for each termination signal.
    • Signal handlers also call app.quit() explicitly: registering a process.on(SIGxxx) listener replaces Node's default terminate-on-signal, so without it the app would keep running after a kill/taskkill. Quitting through the normal path also keeps before-quit teardown intact.
    • ⚠️ session-end is a BrowserWindow event, not an app event (app.on('session-end') doesn't even typecheck). The window is recreated on macOS activate, so the handler re-attaches on every window creation — that detail is what 54ea1cd fixes.

    A SIGKILL still can't be caught, and a real native crash still leaves the marker set — those are supposed to be reported and the tests pin that behaviour explicitly. What's gone is the reporting of ordinary OS-initiated shutdowns.

    A crash detector that cries wolf is worse than no crash detector, because it trains you to ignore the real ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-triage-attemptedAuto-triage script has tried to fix this issuebugSomething isn't workingneeds-triageAwaiting initial reviewsentryAuto-created from Sentry crash report

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions