End processes a mutant's tests fork #1066
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 255 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.332
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1066"
general
weight: 0.35
rishabhsinha17
Part of #872
A test that starts Workers through
LoadGenerator.mp_runleaves them behind once per mutant. mutmut ends a mutant's run withos._exitor a kill, which skips the exit hook that stops daemon processes. Each stranded Worker is small, so the per-mutant memory cap from #1035 never trips. They pile up until the runner dies with "The hosted runner lost communication with the server" and no summary. #946 hits this on every run because it changestest_runtime_metrics_wiring.py, which has anmp_runtest.Now a process a mutant's test forks, and a Python process it starts along with what that one forks, is killed when its parent exits. That reaches Workers, which the multiprocessing forkserver forks. The stats run and the clean run are left alone.
Changes:
A
mutation_orphan_guardmodule in the harness directory setsPR_SET_PDEATHSIGto SIGKILL whenMUTANT_UNDER_TESTnames a mutant. A before-fork hook notes the parent's pid, so a child whose parent already left exits on its own.The
mutation_child_hitsplugin's at-fork hook calls the guard, which covers what a test forks itself.The harness directory's
sitecustomize.pyruns the guard in every interpreter started under a mutant. The forkserver starts by exec and runs no fork hook, so this is what arms it and each Worker it forks.A test that starts a sleeping process through
forkand throughforkserverand leaves throughos._exit(1). The process is gone within 5 s under a mutant and still alive under the stats run.docs/mutation_testing.md.Linux only. Elsewhere
prctlis missing and the guard does nothing. A program that is not Python is not covered.Failing on main:
A local ratchet run for #946 on main left 266 of these processes holding 18.6 GB. The same run on this branch left none.
pdm run validateandpytest tests/required/scripts/test_check_mutation_regression.pyran clean.