← Back to Pull requests

Fix stale MPI requests in `MPI::test_some` #1307

Closed
unknown closed this pull request without merging on Nov 05, 2026 10:26 UTC
View on GitHub
unknown unknown commented on Nov 04, 2026 12:08 UTC
Author

Fixes #1302.

MPI::test_some() for a future map copies the request handles into a local vector before calling MPI_Testsome. MPI_Testsome frees completed requests and sets the handles to MPI_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 in in_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 in RetriesDeferredAllocation on 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. TagMetadataPayloadExchange keeps completed futures in a new finished_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 ReceivesPayloadsCompletingOutOfOrder alternates 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. Full mpi_tests and ucxx_tests pass at np 2 and np 3, and single_tests passes. 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 is TagMetadataPayloadExchange, and it is not exposed in Python.

Diff: 272 lines (+204 / -68) across 3 files Reviewer: wence- Review duration: 1337m
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
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.5% (MEDIUM) · Higher = larger blast radius
39.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.6% · Safe to merge
15.6%