Repository navigation
test: reap e2e dirsql servers when the test process dies - #1116
Merged
Merged
Conversation
Adds the shared server-spawn helper (Drop guard only) and a red test that runs the test binary as a subprocess holding a server, SIGKILLs it, and asserts the server is gone. Fails today: the server survives at PPID 1. Refs #1114 skip-changelog: test harness only
The shared spawn helper sets PR_SET_PDEATHSIG=SIGKILL on the child in pre_exec (Linux), so a server dies with a test process that is SIGKILLed and never unwinds. cli_e2e, cli_repeatable_config_e2e and on_file_e2e now spawn through it and hold the Drop guard, which also covers panics. Fixes #1114 skip-changelog: test harness only
The stale release-ci check runs left on the previous sha carry version numbers willfire no longer predicts, so CI Gate reports them as unpredicted checks and cannot confirm the set is complete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1114
The CLI e2e tests spawn
dirsql serverwithCommand::spawn()and kill it at the end of the body.Childdoes not kill on drop, so a panic before that call or a SIGKILL of the test binary (OOM killer, cargo-mutants timeout, Ctrl-C) leaves the server at PPID 1.Change
packages/rust/tests/common/server.rs: one sharedspawn_serverhelper returning aServerGuardthat kills and waits onDrop. On Linux it setsPR_SET_PDEATHSIG=SIGKILLon the child inpre_exec, so the server dies with the test process even when the process is SIGKILLed and never unwinds. Other platforms get the Drop guard only.cli_e2e.rs,cli_repeatable_config_e2e.rs,on_file_e2e.rsspawn through it.packages/rust/tests/server_reaping_e2e.rs: driver test that runs the test binary as a subprocess filtered to an#[ignore]helper holding a server, SIGKILLs the subprocess, and asserts the server pid is gone within 5 s.Red/green: the first commit (ee3f3af) is the test alone; CI red for the right reason at https://github.com/thekevinscott/dirsql/actions/runs/35153127300/job/104986071034 (
dirsql server 27533 outlived its SIGKILLed test process). The second commit (fe4be59) is the pdeathsig change plus the migration of the three e2e files.Manual exercise
Ran the helper test by hand (
server_reaping_e2e --exact hold_a_server --ignored --nocapture),kill -9on the test process, thenps -eo pid,ppid,args | grep '[d]irsql server --port'.3349098 1 .../target/debug/dirsql server --port 43103 --host localhost(orphan at PPID 1).dirsql serverfrom this worktree inps; the helper test's server (pid 3364680) was gone once its parent was killed.server_dies_when_test_process_is_sigkilledpasses in 0.05 s.CI note
typescript-sdk / Packagingis red here and onmainat c53c932 for the same reason (tsx: not foundinprepack; the upstreampackagingjob no longer installs beforepnpm pack). Tracked in #1117; nothing in this PR touchespackages/ts.E2E Verification
packages/pythonuntouched)packages/tsuntouched)packages/python/e2e-attestations/<branch>.jsonreceipt: not owed (packages/rust/srcuntouched)packages/ts/e2e-attestations/<branch>.jsonreceipt: not owed (packages/rust/srcuntouched)cargo test --workspace --features cli;just preflight --gate <every gate except mutation>(mutation left to CI: uncapped local cargo-mutants runs are off-limits on this host)hold_a_serveris the subprocess helper), exit 0; no orphaned servers after the runChangelog / Migrations
packages/rust/tests/);skip-changelog: test harness onlyon the commits as belt and braces