Skip to content

Flaky crash: macOS test process SIGSEGV in WebContents::DevToolsOpened() during MenuItems toggleDevTools/reload tests #52158

Closed

Description

@claude

Requested by Samuel Attard · Slack thread

The macos-arm64 / test / test (mas, 2) CI shard crashed with a SIGSEGV, killing the test process mid-run. Because the process died, the crashing test never emitted its own ok/not ok result.

Where

  • Run: https://github.com/electron/electron/actions/runs/28218873105 — job macos-arm64 / test / test (mas, 2) (job id 83599264785), 2026-06-26.
  • The crash fired during the MenuItems MenuItem role tests. The last results logged before the crash were:
    • ok 576 MenuItems MenuItem toggleDevTools role toggles devtools on the focused webContents
    • ok 577 MenuItems MenuItem toggleDevTools role toggles parent devtools when invoked with the devtools webContents
    • ok 578 MenuItems MenuItem reload roles reload role reloads the focused webContents
    • then immediately: Received signal 11 SEGV_ACCERR 0000000001e0 followed by ✗ Electron tests failed with kill signal SIGSEGV.

Crash signature

Fault: Received signal 11 SEGV_ACCERR at address 0x1e0. Key frames from the browser-process backtrace (release build, symbolized to symbol+offset only):

4   electron::api::WebContents::DevToolsOpened() + 476
5   electron::api::WebContents::DevToolsOpened() + 476
6   electron::InspectableWebContents::LoadCompleted() + 1212
11  DispatcherImpl::Dispatch(...)
12  electron::InspectableWebContents::HandleMessageFromDevToolsFrontend(...)
15  content::DevToolsFrontendHostImpl::DispatchEmbedderMessage(...)
16  blink::mojom::DevToolsFrontendHostStubDispatch::Accept(...)

The full 55-frame backtrace is in the CI job log.

Observed scope

  • Seen on the macOS mas-2 shard.
  • Not observed on Linux ASAN: the same MenuItems tests run on linux-x64-asan (full tests, on every main push/PR) and have not failed there over the retained CI test-history window.

Activity

  1. MarshallOfSound commented on Aug 11, 2026

    @MarshallOfSound
    Member

    Fixed by #52166

  2. MarshallOfSound commented on Aug 16, 2026

    @MarshallOfSound
    Member

    Reopening, this reproduced on 42-x-y in https://github.com/electron/electron/actions/runs/31910945944/job/95080347500 with the #52166 backport (#52511) already on the branch, so that wasn't the fix.

    Symbolized against the CI binary: DevToolsOpened+476 is handle->owner_window() on the DCHECK_EQ line right after FromOrCreate(isolate, dtwc), and handle.get() is null (WeakReference::IsValid() on 0x0 + offsetof(owner_window_), which is 0x1d0 on 42-x-y and 0x1e0 on main).

    FromOrCreate returns an empty handle because the devtools api::WebContents is a zombie: InspectableWebContents::ShowDevTools creates it eagerly and drops the handle, it's kRemote so never pinned, and nothing holds the wrapper until DevToolsOpened sets devtools_web_contents_. If GC runs while the frontend is loading, FirstWeakCallback marks it dead_ and defers the delete, From() still finds it via the UserDataLink WeakPtr, GetWrapper() returns empty, and we deref null. Same root cause as #29890 / #34042 / #47187.

    We should keep that handle alive from ShowDevTools onwards (a v8::Global on InspectableWebContents cleared on close, or hand it to the owner right away) rather than just null-checking in DevToolsOpened. I'll put up a PR.

  3. sama64867 commented on Aug 16, 2026

    @sama64867
  4. added 4 commits that reference this issue on Aug 17, 2026
    881d822
    374a1a9
    3475088
    215dac9
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions