SIGABRT crash during Electron process exit (ThreadSafeFunction cleanup race)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- electron, node.js, playwright
- Ambito
- desktop, testing-qa
Direzione di ricerca
Inizia riproducendo il teardown di Playwright E2E con più sessioni PTY attive, quindi traccia il percorso ThreadSafeFunction::CallJS attraverso Environment::RunCleanup e CleanupHandles. Il lavoro è completato quando la chiusura rapida delle finestre Electron non produce più crash SIGABRT né report diagnostici di macOS.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- node-pty version: 1.0.0 (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: Playwright E2E tests closing Electron windows
Description
When an Electron app using node-pty closes windows (or quits), macOS crash reports are generated with EXC_CRASH / SIGABRT (abort() called). The crash occurs during Node.js environment cleanup, not during normal operation. All E2E tests pass — the crash happens after test completion during window/process teardown.
This appears to be a race condition in the ThreadSafeFunction cleanup path.
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
void Napi::details::WrapVoidCallback<Napi::ThreadSafeFunction::CallJS(...)>(...)
Napi::ThreadSafeFunction::CallJS(napi_env__*, napi_value__*, void*, void*)
node::ThreadPoolWork::ScheduleWork()::'lambda'(uv_work_s*, int)::__invoke(uv_work_s*, int)
...
node::Environment::CleanupHandles()
node::Environment::RunCleanup()
node::FreeEnvironment(node::Environment*)
Analysis
The crash path shows:
node::FreeEnvironment()begins tearing down the Node.js environmentEnvironment::RunCleanup()/CleanupHandles()fires pending handle callbacks- A node-pty
ThreadSafeFunction::CallJScallback is invoked - Inside the callback,
Napi::Error::ThrowAsJavaScriptException()is called - Since the environment is being destroyed, the exception cannot be handled
- This triggers
__cxxabiv1::failed_throw→std::__terminate→abort()
Reproduction
Occurs consistently (4-5 crashes per E2E test run) when Playwright closes Electron windows that have active PTY sessions. The PTY sessions are created via node-pty and attached to xterm.js terminals.
Steps:
- Create multiple Electron windows with PTY sessions via node-pty
- Close all windows rapidly (as Playwright does during E2E teardown)
- macOS crash reporter triggers for each affected process
Impact
- No functional impact (all operations complete successfully before crash)
- macOS crash report dialogs are disruptive during automated testing
- Crash reports accumulate in
~/Library/Logs/DiagnosticReports/
Potential Fix Direction
The ThreadSafeFunction callback should check whether the environment is still alive before calling ThrowAsJavaScriptException(). Alternatively, the callback should be safely finalized/aborted during Environment::RunCleanup() before it can fire.
- Lingua principale
- TypeScript
- Stelle
- 2k
- Fork
- 337
- Merge medio
- 21h 58m
- PR unite (30g)
- 3
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/node-pty
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Windows: conin socket has no 'error' listener, so a failed pty write is an uncaught exception Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Tutte le issue di microsoft/node-pty
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
AOSSIE-Org/DebateAI#582 · 2 commenti ·