Skip to content

fix(mobile): make cloudflared cleanup really escalate to SIGKILL - #316

Merged
yaojin3616 merged 1 commit into
dataelement:mainfrom
HuangLeijiana:pr/fix-mobile-cloudflared-sigkill
Sep 5, 2026
Merged

fix(mobile): make cloudflared cleanup really escalate to SIGKILL#316
yaojin3616 merged 1 commit into
dataelement:mainfrom
HuangLeijiana:pr/fix-mobile-cloudflared-sigkill

Conversation

@HuangLeijiana

Copy link
Copy Markdown
Contributor

The SIGKILL fallback guarded itself with child.killed, which Node sets as soon as kill('SIGTERM') is called — not when the process exits — so the delayed branch was dead code and a cloudflared that ignores SIGTERM survived every cleanup, leaking an orphaned tunnel process per attempt and keeping the dead quick-tunnel URL reachable.

Extract terminateChildProcess (SIGTERM, then SIGKILL only while exitCode/signalCode are still null) mirroring pinggy-tunnel's correct guard, and pin the escalation, the no-escalation-after-exit, and the already-exited cases with unit tests.

The SIGKILL fallback guarded itself with child.killed, which Node sets
as soon as kill('SIGTERM') is *called* — not when the process exits — so
the delayed branch was dead code and a cloudflared that ignores SIGTERM
survived every cleanup, leaking an orphaned tunnel process per attempt
and keeping the dead quick-tunnel URL reachable.

Extract terminateChildProcess (SIGTERM, then SIGKILL only while
exitCode/signalCode are still null) mirroring pinggy-tunnel's correct
guard, and pin the escalation, the no-escalation-after-exit, and the
already-exited cases with unit tests.
@yaojin3616
yaojin3616 merged commit d58a3de into dataelement:main Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants