Repository navigation
Description
Environment
- Electron 45.2.1 on macOS 27 arm64, main process
@sentry/electron7.14.0 /@sentry/node-native10.60.0, usingeventLoopBlockIntegration@sentry/node-native-stacktrace0.5.1. The native source in 0.5.2 is identical.
What happens
When the watchdog captures a blocked main thread, the Electron main process sometimes aborts with EXC_BREAKPOINT (a failed V8 CHECK). We've seen five of these in two weeks, across several app releases. Most block captures in the same process succeed; one process had six successful captures that day before it crashed.
Crashing main thread, frame-pointer unwind (offsets symbolized against the shipped stack-trace.node):
Electron Framework (V8 CHECK -> brk)
Electron Framework x4
stack-trace.node GetThreadState(v8::Isolate*, AsyncLocalStorageLookup const&) + 144
stack-trace.node ExecutionInterrupted(v8::Isolate*, void*) + 192
Electron Framework (JIT / V8 frames)
...
CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
AppKit -[NSApplication run]
The fault comes after GetStackFrames has finished, inside GetThreadState.
Likely cause
@sentry/node-native registers the main thread with registerThread({ asyncLocalStorage, stateLookup: ["_currentContext", contextSymbol] }). ExecutionInterrupted then runs GetThreadState inside the RequestInterrupt callback, which:
- reads
GetContinuationPreservedEmbedderData()and callsv8::Map::Get - walks
stateLookupwithObject::Get, which can run getters and proxies - then
JSONStringifys the result, which can calltoJSON
All of this happens with no TryCatch and at whatever point V8 serviced the interrupt. Running arbitrary JS and allocating there seems unsafe. #43 reports the same serialization step freezing the thread. Here it ends in a V8 CHECK instead. Electron Framework is stripped, so we couldn't tell which CHECK fails.
Workaround
We patch @sentry/node-native to call registerThread() without the AsyncLocalStorage, so GetThreadState never runs. To keep the user and tags on block events, the poll also merges getIsolationScope().getScopeData() into the scope it passes to threadPoll. That runs on the main thread between ticks, not inside the interrupt.
Suggestion
Keep the interrupt callback to stack capture. Either collect async state outside the interrupt, or make reading it opt-in and wrap it in a TryCatch. Merging the isolation scope in poll() would cover most of what the async lookup provides today.
Activity
timfish commentedon Nov 17, 2026
This essentially removes a feature of this library. I would rather fix it than remove it if possible!
It would only give you the isolation scope at the time of
poll(). The isolation scope can change after that and you would get the wrong scope.abbmarand commentedon Nov 18, 2026
Oh, sorry for that haha.
The crash is
Fatal error: Invoke in DisallowJavascriptExecutionScope. V8 15.4 added a check that aRequestInterruptcallback can't run JS, andv8::Map::GetinGetThreadStateruns JS. The check is off in Node's own build so it only shows up in Electron, and only when the thread is blocked inside an ALS context.I got it working without removing anything by using
Map::AsArray()instead ofMap::Getand skipping getters/proxies. Tested with the real SDK on Electron 45, the scope from the time of the block is still on the event.Should I open a PR?