Fix stale MPI requests in `MPI::test_some` #1307
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 #1307"
general
weight: 0.35
wence-
Fixes #1302.
MPI::test_some()for a future map copies the request handles into a local vector before callingMPI_Testsome.MPI_Testsomefrees completed requests and sets the handles toMPI_REQUEST_NULL, but only in that copy, so the futures keep the freed handles.TagMetadataPayloadExchange::complete_data_transfers()only takes a completed receive when it is at the front of its peer's queue. When a payload receive completes before an earlier one from the same peer, the completed future stays inin_transit_futures_and its freed request is passed to MPI again on the next call. That is undefined behavior: MPI may never report it completed, which I suspect is the hang inRetriesDeferredAllocationon GH200, or the freed request gets reused and the process crashes.This PR follows the vector overload of
test_some(): completed futures are erased from the map and returned, so a freed request is never passed to MPI again.TagMetadataPayloadExchangekeeps completed futures in a newfinished_futures_map until the earlier messages from the same peer complete. The UCXX backend did not have the bug, but gets the same interface change.The new test
ReceivesPayloadsCompletingOutOfOrderalternates 16 MiB and 64 B payloads so small receives finish before the large ones in front of them. On x86 (RTX 6000 Ada, Open MPI) it segfaulted in 3 of 3 runs at np 2 without the fix and passes 10 of 10 with it. Fullmpi_testsanducxx_testspass at np 2 and np 3, andsingle_testspasses. On GH200 and B300, this comment confirms that the hang no longer reproduces and that the full MPI and UCXX test suites pass at 2 and 3 ranks.Breaking change
The map overload of
Communicator::test_some()now takes the map by non-const reference, erases the completed futures from it and returns them, instead of returning their keys. This changes a public signature. No deprecation period is needed since nobody uses this API directly: its only caller isTagMetadataPayloadExchange, and it is not exposed in Python.