Skip to content

test(cli): stop the pidfile zombie test racing the shell's reaper - #259

Merged
ralyodio merged 1 commit into
masterfrom
fix/pidfile-zombie-test-race
Sep 26, 2026
Merged

ralyodio merged 1 commit into
masterfrom
fix/pidfile-zombie-test-race

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

isProcessAlive on a zombie spawned sh -c 'true & echo $!; exec sleep 30'. If true exits before the exec, sh reaps it and /proc/<pid>/stat disappears, so the poll throws ENOENT. It failed twice in a row on #255.

  • background sleep 0.5 so the child exits after the shell has exec'd into a process that never waits
  • tolerate a missing stat file while polling, and yield between polls instead of busy-spinning
  • assert the zombie state was actually reached before testing isProcessAlive

Ran the file 8 times locally: 8/8 pass.

🤖 Generated with Claude Code

`sh -c 'true & ...; exec sleep 30'` only leaves a zombie if `true` exits
after the exec. When it exits first, sh reaps it and /proc/<pid>/stat is
gone, so the poll threw ENOENT (failed twice in a row on #255's CI).
Background a short sleep instead so the child outlives the exec, tolerate
a missing stat file while polling, and assert the zombie state was reached.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

16 finding(s)

HIGH/CRITICAL: 1 | MEDIUM: 7 | LOW: 8

Severity Rule Location
HIGH secret-aws-access-key prd/0003-detect-hardcoded-secrets-before-they-are-committed-or-served.md:126
MEDIUM sql-string-concatenation .github/workflows/migrate-dev2.yml:113
MEDIUM js-open-redirect apps/web/src/app/auth/login/page.tsx:66
MEDIUM js-unescaped-html-sink apps/web/src/app/hire/page.tsx:104
MEDIUM js-unescaped-html-sink apps/web/src/app/hire/page.tsx:108
MEDIUM js-open-redirect apps/web/src/components/funding/FundingClient.tsx:97
MEDIUM js-unescaped-html-sink apps/web/src/components/GuideReader.tsx:265
MEDIUM js-uninitialized-buffer packages/scan/src/node-rules.ts:456
LOW secret-generic-credential apps/web/src/app/api/auth/refresh/route.ts:17
LOW secret-generic-credential apps/web/src/app/api/auth/reset-password/route.ts:26
LOW secret-generic-credential apps/web/src/app/api/auth/reset-password/route.ts:27
LOW secret-generic-credential PRD.md:269
LOW tls-verification-disabled prd/0004-find-dangerous-code-patterns-without-pretending-to-be-a-compiler.md:121
LOW tls-verification-disabled prd/0004-find-dangerous-code-patterns-without-pretending-to-be-a-compiler.md:122
LOW sh-remote-script-execution scripts/smoke-test.sh:47
LOW secret-aws-access-key scripts/smoke-test.sh:112

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit f37e102 into master Sep 26, 2026
12 checks passed
@ralyodio
ralyodio deleted the fix/pidfile-zombie-test-race branch September 26, 2026 01:47
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.

1 participant