Skip to content

net-ib: report a failed connection setup instead of crashing on it - #10484

Merged
i-kosarev merged 10 commits into
developfrom
netibmpi-setup-helper-hardening
Oct 14, 2026
Merged

i-kosarev merged 10 commits into
developfrom
netibmpi-setup-helper-hardening

Conversation

@i-kosarev

@i-kosarev i-kosarev commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

A NetIbMPI test whose connection setup failed did not report that failure, it crashed, and the actual cause scrolled off the top of a page of backtraces. A failed network setup therefore looked like a dozen unrelated crashes.

There are two causes, one on each side of the plugin boundary, and either alone is enough to lose the message.

Technical Details

Three things, in the order a failure hits them.

The setup helpers fail unilaterally, and every early return strands the peer: a listen failure never sent the handle, so the connector waited in MPI_Recv until the suite timeout, and a failure after that skipped the closing barrier, so the other side waited there instead. SetupConnection and SetupCastConnection now agree before anyone gives up. The handle message carries a status word and is sent even when listen failed, so the connector always has something to read, and the closing barrier became an MPI_Allreduce of that status, so both ranks return the same verdict. SetupCastConnection asserts after the reduction rather than before it, which is what makes its fatal assertion safe. The threaded path already worked this way -- SetupConnectionForThread exchanges a listener-ready flag for exactly this reason -- so this brings the serial helpers to the same contract.

SetupConnectionWithGuard, SetupCastConnection and SetupConnection are void and assert internally, and a fatal gtest assertion returns from the helper rather than from the test, so the body carried on with a connection that was never established. All 76 call sites now wrap the call in ASSERT_NO_FATAL_FAILURE, the gtest idiom for propagating that failure outward. Mechanical, one line each, no signatures changed.

The body's next call is RegisterMemory, and regMr reads the device list straight off the communicator, so a null comm faulted inside librccl: observed in ncclIbRegMrDmaBufInternal and IbCastRegMrDmaBufInternal. regMr, regMrDmaBuf and deregMr in net_ib_cast only now reject a null communicator with ncclInvalidArgument and a WARN, and regMr rejects a zero size instead of relying on a release-build assert.

The net_ib copy of that guard was in an earlier revision of this PR and was taken out again on review: the setup helpers this change is about all run over net_ib_cast in this suite, so nothing here exercised the net_ib copy. The same crash is reachable through ncclNetIb.regMr/regMrDmaBuf/deregMr and is worth its own change with its own coverage -- it is deliberately not in this one.

The first change is what removes the hang, the second stops the body running on a dead connection, and the guards make the invalid argument observable for every caller rather than fatal. That last part is why this is not test-only.

Issue Tracking

JIRA ID: AICOMNET-323

Test Plan

  • Rebuild rccl-UnitTestsMPI in a debug configuration with MPI tests enabled.
  • Run the full net_ib_transport.json configuration and compare the non-passing set against develop, since the point is that nothing changes except the shape of a failure.

Test Result

Two ranks, develop at 6c54d4074c:

  • Full NetIB configuration: 342 PASS / 1 FAIL / 0 HANG / 8 SKIP / 1 ERROR (352 total), which is the same set develop produces. The two non-passing entries are pre-existing: GdrFlush_ForcedScratchpadWrite_ReproducesFault fails and NetIB_CtsDepthStress errors.
  • Nine representative transfer, registration and fused-device tests pass individually after the change.

Submission Checklist

@i-kosarev
i-kosarev requested review from a team and a lite review from Copilot August 20, 2026 17:47
@therock-pr-bot

therock-pr-bot Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rccl/src/transport/net_ib_cast/reg.cc, projects/rccl/test/transport/NetIbMPI/CastTests.cpp, projects/rccl/test/transport/NetIbMPI/FaultInjectTests.cpp, projects/rccl/test/transport/NetIbMPI/GdrFlushTests.cpp, projects/rccl/test/transport/NetIbMPI/GeneralTests.cpp (+5 more); no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves NetIB/NetIB-CAST failure reporting by ensuring connection-setup failures propagate out of gtest helpers (instead of continuing with an uninitialized connection) and by adding defensive argument validation in the transport plugins to avoid null-communicator crashes.

Changes:

  • Wraps SetupConnectionWithGuard / SetupCastConnection call sites with ASSERT_NO_FATAL_FAILURE(...) so fatal assertions abort the test correctly.
  • Adds comm == NULL (and mhandle == NULL) guards in NetIB and NetIB-CAST regMr/deregMr paths to return ncclInvalidArgument with a warning instead of crashing.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
projects/rccl/test/transport/NetIbMPI/StressTests.cpp Propagates connection-setup fatal assertions to stop tests cleanly.
projects/rccl/test/transport/NetIbMPI/NicFusionTests.cpp Same assertion propagation for vNIC fusion test setup.
projects/rccl/test/transport/NetIbMPI/GeneralTests.cpp Same assertion propagation for general NetIB tests.
projects/rccl/test/transport/NetIbMPI/GdrFlushTests.cpp Same assertion propagation for GDR flush test setup.
projects/rccl/test/transport/NetIbMPI/FaultInjectTests.cpp Same assertion propagation for cast connection setup in fault-injection tests.
projects/rccl/test/transport/NetIbMPI/CastTests.cpp Same assertion propagation for cast connection setup in cast tests.
projects/rccl/src/transport/net_ib/reg.cc Adds null-argument guards in MR register/deregister to avoid null-comm crashes.
projects/rccl/src/transport/net_ib_cast/reg.cc Adds null-argument guards in MR register/deregister to avoid null-comm crashes (cast).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@i-kosarev
i-kosarev requested a balanced review from Copilot August 20, 2026 18:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Suppressed comments (6)

projects/rccl/test/transport/NetIbMPI/GeneralTests.cpp:97

  • This propagates a setup assertion only on the rank where it occurred. SetupConnection can return before its final MPI_Barrier (and a listen failure returns before rank 0 sends the handle), so the peer can remain blocked in MPI_Recv, polling, or the barrier indefinitely. The suite already avoids unilateral fatal assertions for this reason in NicFusionTests.cpp:464-475. Please make the setup protocol exchange/synchronize status so both ranks leave together before relying on this wrapper.
    ASSERT_NO_FATAL_FAILURE(SetupConnectionWithGuard(0, pair, connGuard));

projects/rccl/test/transport/NetIbMPI/CastTests.cpp:34

  • ASSERT_NO_FATAL_FAILURE only exits the local test. SetupCastConnection has unilateral fatal exits before its final MPI_Barrier; for example, a rank-0 listen failure leaves rank 1 blocked in MPI_Recv, while a later one-sided failure can leave the peer in the barrier. Coordinate setup status between ranks and ensure both ranks take the same exit path, as the explicit pattern in NicFusionTests.cpp:464-475 does.
    ASSERT_NO_FATAL_FAILURE(SetupCastConnection(/*dev=*/0, &listenComm, &sendComm, &recvComm));

projects/rccl/src/transport/net_ib/reg.cc:77

  • The new null-communicator behavior in both regMr and deregMr is not exercised by the existing registration negative tests, so a guard regression would restore the plugin crash unnoticed. Add direct netIb tests that call these operations with a null communicator and verify ncclInvalidArgument without requiring a failed connection setup.
  if (comm == NULL || mhandle == NULL) {
    WARN("NET/IB: regMr called with comm=%p mhandle=%p", comm, (void*)mhandle);
    return ncclInvalidArgument;

projects/rccl/src/transport/net_ib_cast/reg.cc:78

  • The cast copy of the new null-communicator guards has no targeted coverage. Add netIbCast negative tests for null-comm registration and deregistration so this independently maintained implementation cannot regress to dereferencing the communicator.
  if (comm == NULL || mhandle == NULL) {
    WARN("NET/IB-CAST: regMr called with comm=%p mhandle=%p", comm, (void*)mhandle);
    return ncclInvalidArgument;

projects/rccl/test/transport/NetIbMPI/StressTests.cpp:32

  • If setup fails after creating a listen/recv/send object, SetupConnectionWithGuard returns from its internal fatal assertion before assigning pair into guard. This outer assertion then exits the test with those partial connection objects unowned, and fixture finalization does not close them. Have the helper adopt every non-null partial object into the guard (or close it) before reporting the setup failure.
    ASSERT_NO_FATAL_FAILURE(SetupConnectionWithGuard(/*dev=*/0, cp, guard));

projects/rccl/test/transport/NetIbMPI/FaultInjectTests.cpp:91

  • A fatal setup result now returns from the test before its normal close calls, but SetupCastConnection may already have created listenComm or another partial comm. Those raw pointers are not guarded, so failed tests leak plugin/RDMA resources into subsequent tests. Make the setup helper clean partial state on failure or transfer it immediately to an RAII guard.
    ASSERT_NO_FATAL_FAILURE(SetupCastConnection(/*dev=*/0, &listenComm, &sendComm, &recvComm));

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

projects/rccl/test/transport/NetIbMPI/GeneralTests.cpp:868

  • This accept loop is still unbounded when AcceptConnection repeatedly returns ncclSuccess with a null communicator, so the new MPI_Allreduce is never reached and the test can still hang on a dead fabric. Apply the same kConnectTimeoutMs watchdog used by SetupConnection.

This issue also appears on line 875 of the same file.

                while (!pair.recvComm && r == ncclSuccess)
                    r = AcceptConnection(pair.listenComm, &pair.recvComm);

projects/rccl/test/transport/NetIbMPI/GeneralTests.cpp:876

  • The connector has the same unbounded pending path: repeated successful calls returning a null communicator spin forever, preventing both ranks from reaching the failure reduction. Bound and pace this loop with the connection timeout, as SetupConnection does.
                while (!pair.sendComm && r == ncclSuccess)
                    r = ConnectToRemote(mergedDev, &handshake.handle, &pair.sendComm);

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (3)

Previously missed (3) — in code that hasn't changed since the last review.

projects/rccl/test/transport/NetIbMPI/GeneralTests.cpp:868

  • These connect/accept APIs are asynchronous and may repeatedly return ncclSuccess with a null communicator. Unlike SetupConnection, both loops here remain unbounded, so a stalled fabric can still keep one or both ranks from ever reaching the new reduction and the test hangs until the suite timeout. Apply the same polling deadline to both branches.
                ncclResult_t r = ncclSuccess;
                while (!pair.recvComm && r == ncclSuccess)
                    r = AcceptConnection(pair.listenComm, &pair.recvComm);
                if (r != ncclSuccess || !pair.recvComm) connectFailed = 1;

projects/rccl/src/transport/net_ib/reg.cc:78

  • The new null-communicator contract is not exercised by the existing registration tests: RegisterMemoryNullPointer uses a live communicator with null data, and DeregisterNullHandle also uses a live communicator. Since setup failures now stop the test body, the failure scenario will not reach these guards either. Add direct regMr/regMrDmaBuf and non-null-handle deregMr calls with a null communicator, asserting ncclInvalidArgument.
  if (comm == NULL || mhandle == NULL || size == 0) {
    WARN("NET/IB: regMr called with comm=%p mhandle=%p size=%zu", comm, (void*)mhandle, size);
    return ncclInvalidArgument;

projects/rccl/src/transport/net_ib_cast/reg.cc:78

  • The IB-CAST null-communicator paths are not covered by the current CAST tests; all registration calls use the live communicator created by SetupCastConnection. Add direct null-communicator checks for regMr/regMrDmaBuf and non-null-handle deregMr, asserting ncclInvalidArgument, so this duplicated implementation cannot drift from net_ib.
  if (comm == NULL || mhandle == NULL || size == 0) {
    WARN("NET/IB-CAST: regMr called with comm=%p mhandle=%p size=%zu", comm, (void*)mhandle, size);
    return ncclInvalidArgument;

@i-kosarev
i-kosarev requested a review from amd-arozanov August 21, 2026 17:27
@github-actions

Copy link
Copy Markdown
Contributor

RCCL Perf-Regression Gate: ⚠️ NO VERDICT (not measured)

This run did not produce a usable answer. It is neither a PASS nor a regression — treat the perf gate as not run for this change.

Why:

  • this report predates the trustworthiness flag, or a group could not be scored

Mode: detect (reference vs candidate)
Thresholds: small 17.2% · mid 12.3% · large 12.9%
Keys compared: 0 · Confirmed regressions: 0 · Inconclusive: 0
Provenance: n/a

Per-collective breakdown
group keys regressions inconclusive
all_gather_perf-d=bfloat16-default 0 0 0
all_gather_perf-d=float-default 0 0 0
all_reduce_perf-d=bfloat16-default 0 0 0
all_reduce_perf-d=float-default 0 0 0
broadcast_perf-d=bfloat16-default 0 0 0
broadcast_perf-d=float-default 0 0 0
reduce_scatter_perf-d=bfloat16-default 0 0 0
reduce_scatter_perf-d=float-default 0 0 0

@i-kosarev
i-kosarev requested a review from atulkulk August 21, 2026 18:12
@i-kosarev
i-kosarev requested review from amd-arozanov and a balanced review from Copilot August 24, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (3)

Previously missed (3) — in code that hasn't changed since the last review.

projects/rccl/test/transport/NetIbMPI/CastTests.cpp:1288

  • If connection c > 0 fails, this fatal wrapper returns from the test immediately. SetupCastConnection cleans only the failing connection, while connections [0, c) remain stored in these vectors and the teardown loop at the end is skipped, leaking their listeners/QPs into subsequent tests. Install RAII cleanup for all entries before this loop (or explicitly clean previously established entries before propagating the fatal failure).
        ASSERT_NO_FATAL_FAILURE(SetupCastConnection(/*dev=*/0, &listenComms[c], &sendComms[c], &recvComms[c]));

projects/rccl/src/transport/net_ib_cast/reg.cc:134

  • The null-communicator guard is bypassed when mhandle is also null because the existing no-op return runs first. Thus deregMr(nullptr, nullptr) still succeeds silently, contrary to the PR's stated contract that deregMr rejects a null communicator; check comm before applying the null-handle no-op (which still preserves success for a null handle on a valid communicator).
  if (comm == NULL) {
    WARN("NET/IB-CAST: deregMr called with a null comm");
    return ncclInvalidArgument;
  }

projects/rccl/src/transport/net_ib/reg.cc:134

  • The null-communicator guard is bypassed when mhandle is also null because the existing no-op return runs first. Thus deregMr(nullptr, nullptr) still succeeds silently, contrary to the PR's stated contract that deregMr rejects a null communicator; check comm before applying the null-handle no-op (which still preserves success for a null handle on a valid communicator).
  if (comm == NULL) {
    WARN("NET/IB: deregMr called with a null comm");
    return ncclInvalidArgument;
  }

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: LGTM. 2 finding(s) below High not posted this round; comment @argus re-review full for a full pass if you want them.

Comment @argus review to re-run, or @argus re-review after pushing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Hardware-dependent MPI/RDMA synchronization and cleanup changes warrant final human validation.

Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: Worth settling before approval: the new ASSERT_NO_FATAL_FAILURE at CastTests.cpp:1566 wraps a rank-local assertion, so a one-sided IB init failure strands the peer in SetupCastConnection's reduction. The CHANGELOG entry agreed last round is also missing from this head.

Comment @argus review to re-run, or @argus re-review after pushing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new readiness reduction can proceed after failed NetIB initialization because it only considers the device count.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Low-level MPI synchronization and RDMA resource cleanup require final human validation under real multi-node failure conditions.

Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: 5 new finding(s) below High not posted this round (@argus re-review full for a full pass); still open from earlier: reg.cc:78. Worth clearing before approval.

Comment @argus review to re-run, or @argus re-review after pushing.

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: Nothing new worth raising; still open from earlier: reg.cc:80. Worth clearing before approval.

Comment @argus review to re-run, or @argus re-review after pushing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Two CAST tests still fail to propagate fatal setup failures from the helper.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Two CAST setup callers remain unwrapped and can continue with null communicators after failure.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: Nothing new worth raising; still open from earlier: reg.cc:80. Worth clearing before approval.

Comment @argus review to re-run, or @argus re-review after pushing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The central coordinated setup-failure paths lack an automated two-rank regression test.

Review effort: Balanced
Findings: None

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: LGTM.

Comment @argus review to re-run, or @argus re-review after pushing.

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: Nothing new worth raising; still open from earlier: reg.cc:78. Worth clearing before approval.

Comment @argus review to re-run, or @argus re-review after pushing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Several setup callers remain unwrapped, and failed stress-test cleanup can still leak resources.

3 open findings

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The central unilateral-failure synchronization paths lack deterministic regression coverage.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: LGTM.

Comment @argus review to re-run, or @argus re-review after pushing.

i-kosarev and others added 10 commits October 11, 2026 11:21
…aBuf/deregMr

A caller that lost its connection can reach these entry points with a null
communicator. regMr/regMrDmaBuf read the device list off it before checking, and
a zero size hits the same null-dereference fate through the page-count math on
the way to a release-build assert; deregMr dereferences it directly. All three
now return ncclInvalidArgument and log a WARN instead of segfaulting inside the
plugin.

deregMr keeps its existing null-handle-is-a-no-op short circuit ahead of the new
check, so a null handle with a null comm is still ncclSuccess -- that shortcut
predates this change and nothing here needed it to move.
… not one

SetupConnection, SetupCastConnection and TeardownConnection each had the same
shape: a fatal check or an early return on one rank while the peer waited in
MPI_Recv or a barrier for a message that a failed rank never sends. Reachable
from this branch's own subject -- a null-comm crash inside the plugin -- since
before this, a torn-down connection reaching regMr with a null comm on one rank
left the other rank blocked rather than reporting anything.

SetupConnection and SetupCastConnection now send a status word instead of a
bare handle, so a listen failure is reported rather than leaving the peer to
interpret a handle nobody filled in. Both close whatever they created on a
failure path, since callers now treat the result as recoverable rather than
fatal-and-unwind. TeardownConnection downgrades its checks from ASSERT_ to
EXPECT_ for the same reason: every rank-local check it makes precedes a
barrier, and a fatal one would return from the helper while the peer waited
there.
…eListen

Same defect as SetupConnection, in a test that cannot use it: this loop builds
its own listen/connect handshake rather than the shared helper, so it needed
the same fix independently. A listen failure on rank 0 skipped sending the
handle, leaving rank 1 in an unbounded MPI_Recv; accept/connect themselves
spun without a timeout. The handle now travels with a status word so a listen
failure is observable on both ranks, and the accept/connect loops are bounded
by the same connect timeout SetupConnection uses. Close on the failure path
releases whichever local comms did complete before the peer's did not, since
FAIL() would otherwise skip the loop's normal close and leak them. The
close-comm checks inside the iteration loop move from ASSERT_ to EXPECT_ for
the same reason as TeardownConnection: a fatal exit here would skip the next
iteration's handshake and strand the peer.
…AILURE

SetupConnectionWithGuard asserts fatally on its own setup call, and a fatal
assertion inside a helper returns from the helper alone, not from the caller.
Every existing test called it bare, so a setup failure on one rank let that
test body carry on into its own logic while its peer -- whose setup succeeded
-- waited at whatever collective came next, the same unilateral-exit hang the
rest of this branch removes from the shared helpers directly. Wrapping the
call is what actually propagates the fatal failure out of the test body.

Mechanical across both files: every call site follows the identical two-line
shape (construct the guard, then call), so there is nothing here to choose
between sites.
…SERT_NO_FATAL_FAILURE

Same reasoning as the SetupConnectionWithGuard wrapping: SetupCastConnection
now asserts fatally on its own setup, and that assertion returns from the
helper rather than the caller, so a bare call let a one-sided setup failure
carry the calling test into fault-injection logic while its peer waited
elsewhere. Mechanical across all twenty call sites in this file.
…ss test, add a regression test for the null-comm guard

Three related changes to this file, all downstream of SetupCastConnection now
asserting fatally on its own setup instead of leaving a torn setup for the
caller to notice.

Every existing call site is wrapped in ASSERT_NO_FATAL_FAILURE -- mechanical,
fifteen sites, same reasoning as the other files in this branch.

CastStressMultiRoundTwoConns opens a hundred connections and registers memory
on each; a setup, registration, or teardown failure partway through used to
return with the rest still open and still registered, contaminating the rest
of the process. The per-connection state (handles, mhandles, buffers) now
lives behind a scope guard that closes and deregisters whatever is still held
on any exit, dismissed only after the normal teardown loop succeeds; that
teardown loop itself moved from ASSERT_ to EXPECT_ so a rank-local close
failure cannot strand the peer at the closing barrier the way ListenCloseListen
was rewritten to avoid.

CastRegistrationRejectsBadArguments is new: it exercises the production guard
this branch adds directly (null comm to regMr/regMrDmaBuf/deregMr, zero size to
regMr), pinning that deregMr's pre-existing null-handle-is-a-no-op short
circuit still runs ahead of the new comm check.
…usionTests

Same defect, same fix, in the two files that had not been touched yet:
SetupConnectionWithGuard and GdrFlushTests' own RunRecvFlushBurst both assert
fatally on setup now, so a bare call let a one-sided failure carry the caller
past its own peer's block. Mechanical across all call sites in both files.
…nfig that carries the Cast set

All seven configs list the identical Cast test set, and the guard under test
lives in net_ib_cast, so the AINIC and RoCE runs are where it matters most.
Registered alongside its siblings in each.
…uisites are absent

This test has no useful assertion without its two-rank, two-node launch shape. validateTestPrerequisites already reaches the same verdict on every rank, so SKIP_UNLESS_MPI_PREREQS preserves the other NetIbMPI tests' supported-launch behavior instead of failing the suite.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep failed deregistration and close handles owned by the multi-connection scope guard for a retry after the rank-agreed barrier. Wrap the setup calls develop added in the optional-recv and GID-change tests so a rank-agreed setup failure stops the test body before it can use null communicators.

Co-authored-by: Cursor <cursoragent@cursor.com>

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGUS

Bottom line: LGTM.

Comment @argus review to re-run, or @argus re-review after pushing.

@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants