-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Environment
- node-pty: via
@electron/rebuild - Electron: 35.7.5
- Node.js: v24 (Electron embedded, NODE_MODULE_VERSION 141)
- OS: macOS 26.3.1 (Darwin 25.3.0), ARM64 (Apple Silicon)
- Reproduction context:
pnpm test:e2e(Playwright + Electron)
Description
When running E2E tests, macOS generates 4-5 Electron crash reports (Electron-*.ips) during test teardown. All tests pass — the crashes occur after test completion when Electron windows/processes are closing.
This is a race condition in node-pty's N-API ThreadSafeFunction cleanup during Node.js environment destruction.
Crash Stack (from macOS .ips report)
__pthread_kill
pthread_kill
abort
__abort_message
demangling_terminate_handler()
_objc_terminate()
std::__terminate(void (*)())
__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)
__cxa_throw
Napi::Error::ThrowAsJavaScriptException() const
Napi::ThreadSafeFunction::CallJS(napi_env__*, napi_value__*, void*, void*)
node::Environment::CleanupHandles()
node::Environment::RunCleanup()
node::FreeEnvironment(node::Environment*)
Root Cause
node::FreeEnvironment()begins tearing down the Node.js environmentCleanupHandles()fires pending node-ptyThreadSafeFunctioncallbacks- Inside the callback,
ThrowAsJavaScriptException()is called - The environment is already being destroyed, so the exception cannot be handled
- This triggers
failed_throw→std::__terminate→abort()
Impact
- No functional impact — all E2E tests pass, crash happens post-teardown
- macOS crash report dialogs are disruptive during automated testing
- Reports accumulate in
~/Library/Logs/DiagnosticReports/
Workaround
Ignore the crash reports. They do not represent application bugs.
Potential Fix Direction
- Ensure all PTY sessions are fully killed + awaited before Electron
will-quitfires inPtyRuntime.dispose() - Or upgrade node-pty if a version with fixed
ThreadSafeFunctioncleanup ordering becomes available
Upstream issue filed: microsoft/node-pty#904
First Observed
2026-03-27, E2E: 169 passed / 0 failed, 5 crash reports generated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels