Summary
The Python child is not spawned detached in its own process group and is not reaped; the only cleanup is a single SIGTERM on before-quit with no wait and no SIGKILL fallback.
Location
electron/main.ts:144, 452-455
Evidence
pythonProcess = spawn(cmd, args, { env, stdio: ["pipe","pipe","pipe"] }); // no detached / group handling
...
app.on("before-quit", () => { if (pythonProcess) { pythonProcess.kill("SIGTERM"); pythonProcess = null; } });
Failure scenario
User force-quits the app or it crashes (SIGKILL, OOM) -> before-quit never runs -> the backend keeps running orphaned, holding its port and potentially still mutating system state. Even on clean quit, a backend slow to handle SIGTERM is never force-killed.
Fix
Spawn detached in its own group and kill the group; add a SIGKILL fallback after a timeout; consider a parent-death watchdog on the Python side.
Summary
The Python child is not spawned detached in its own process group and is not reaped; the only cleanup is a single
SIGTERMonbefore-quitwith no wait and noSIGKILLfallback.Location
electron/main.ts:144, 452-455Evidence
Failure scenario
User force-quits the app or it crashes (
SIGKILL, OOM) ->before-quitnever runs -> the backend keeps running orphaned, holding its port and potentially still mutating system state. Even on clean quit, a backend slow to handle SIGTERM is never force-killed.Fix
Spawn detached in its own group and kill the group; add a
SIGKILLfallback after a timeout; consider a parent-death watchdog on the Python side.