fix(browser): reap orphaned Chromes when parent dies hard
chromedp launches Chrome as detached subprocesses; on SIGKILL, OOM, or any path that bypasses our cleanup chain they reparent to PID 1 and survive indefinitely. Each launch now allocates a known harness-browser-* user-data-dir and registers it with a single detached /bin/sh watchdog spawned via Setsid. When the parent dies the watchdog detects stdin EOF and pkills + rm -rfs every still-tracked path. Clean teardown untracks the path so a later hard exit can't kill the next session sharing the process.
This commit is contained in:
1 parent
cc0406d30c
commit
0ca0fed9f7
3 files changed
+147
No files matched your search
@@ -0,0 +1,10 @@
|
||||
//go:build !unix
|
||||
|
||||
package browser
|
||||
|
||||
// Stubs for platforms without POSIX pkill/sh. Windows callers fall back
|
||||
// to chromedp's own teardown; hard-kill orphans are a known limitation
|
||||
// there until we add a native implementation (e.g. Job Objects).
|
||||
|
||||
func trackDirForReaping(dir string) {}
|
||||
func untrackDirForReaping(dir string) {}
|
||||
Reference in new issue
Block a user