Exit spawned test workers with os._exit to avoid gloo abort at shutdown #9100
All Vouch review confidence checks passed
Residual risk 0.16 = 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 · 272 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.336
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9100"
general
weight: 0.35
jinyouzhi
Fixes #9089.
Root cause
A worker of
TestAutoTPCompileTiedEmbeddings::...[False]occasionally aborts withterminate called without an active exceptionafter the test body has passed.Native backtrace of the abort (CPU, gloo, torch 2.14, Python 3.12):
spawnmethod, so they run full interpreter finalization on exit.fork/forkserverchildren end withos._exit.runLoopthread can still be releasing the last reference to a Python-owned tensor. Acquiring the GIL there makes CPythonpthread_exitthe thread, and the forced unwind through anoexceptframe callsstd::terminate.destroy_process_group()alone is not enough: with DeepCompile the compiled graph keeps the TP group alive (placeholdermeta['example_value']), so the gloo threads are not joined.This reproduces without DeepSpeed: 2 spawned gloo ranks doing one
all_reduceand returning withoutdestroy_process_group()abort in 3 of 60 runs.Fix (test harness workaround)
Spawned workers now exit through a small
mp.Processsubclass that callsos._exitafter_bootstrap, matching the existing fork/forkserver behavior. No collective runs at teardown, so a rank whose test fails cannot leave the others blocked.Testing
Local CPU repro (
DS_ACCELERATOR=cpu,DS_DISABLE_REUSE_DIST_ENV=1,pytest --forked -m sequential unit/compile/test_tp_compile.py::TestAutoTPCompileTiedEmbeddings, repeated):Harness semantics: a test failing on only one rank still reports
Worker 1 exited with code 1with the assertion;pytest.skipinside workers is still propagated.Other non-daemonic tests on CPU (
unit/compile/test_tp_compile.py,unit/pipe/test_pipe_module.py,unit/comm/test_dist.py,unit/v1/compile/test_compile_zero.py,unit/v1/autotp/test_tp_plan_e2e.py,unit/v1/half_precision/test_keep_in_fp32_modules.py): 139 passed, 62 skipped.