Skip to content

[RCCL][test] Fix illegal MPI_Cancel on Ibarrier in MPIEnvironment tea… - #9322

Merged
JhaShweta1 merged 1 commit into
users/corey-derochie-amd/aicomrccl-1281-sync-nccl-2.30.7from
users/shwetjha/test_harness_fix
Jul 27, 2026
Merged

JhaShweta1 merged 1 commit into
users/corey-derochie-amd/aicomrccl-1281-sync-nccl-2.30.7from
users/shwetjha/test_harness_fix

Conversation

@JhaShweta1

Copy link
Copy Markdown
Contributor

The TearDown safety-net cancelled a nonblocking collective (MPI_Ibarrier) request on timeout, which the MPI standard forbids. OpenMPI raises MPI_ERR_REQUEST and, because MPI_COMM_WORLD uses MPI_ERRORS_ARE_FATAL, that MPI_Cancel call itself aborts the job with a misleading error before the intended MPI_Abort runs. Remove the MPI_Cancel/MPI_Request_free and call MPI_Abort directly (it tears the job down anyway).

Also raise the teardown-barrier timeout 3s -> 60s (overridable via RCCL_TEST_TEARDOWN_TIMEOUT_SEC) so benign rank skew in heavy multi-phase MPI tests (GrowMPITest, NetIbMPITest CtsDepthStress) no longer trips a false 'out of sync' abort.

Test-harness only; no librccl behavior change. Recovers Grow_MultiRankJump and NetIB_CtsDepthStress (ib-cast) from false failures.

Motivation

Fix an illegal MPI_Cancel on a nonblocking-barrier request that crashed MPI test teardown, causing passing tests to be reported as failures.

Technical Details

MPIEnvironment::TearDown() uses an MPI_Ibarrier + poll-with-timeout as a safety net. On timeout it called MPI_Cancel(&barrier_req) — but cancelling a nonblocking collective request is forbidden by the MPI standard. OpenMPI returns MPI_ERR_REQUEST, and since MPI_COMM_WORLD uses the default MPI_ERRORS_ARE_FATAL handler, that MPI_Cancel call itself aborts the job (before the intended MPI_Abort). Fix: drop the MPI_Cancel/MPI_Request_free and call MPI_Abort directly. Also raised the barrier timeout 3s→60s (env-overridable via RCCL_TEST_TEARDOWN_TIMEOUT_SEC) so benign rank skew in heavy multi-phase tests doesn't trigger a false abort. Test-harness only; no librccl change.

Issue Tracking

Test Plan

Test Result

Submission Checklist

…rdown

The TearDown safety-net cancelled a nonblocking collective (MPI_Ibarrier)
request on timeout, which the MPI standard forbids. OpenMPI raises
MPI_ERR_REQUEST and, because MPI_COMM_WORLD uses MPI_ERRORS_ARE_FATAL,
that MPI_Cancel call itself aborts the job with a misleading error before
the intended MPI_Abort runs. Remove the MPI_Cancel/MPI_Request_free and
call MPI_Abort directly (it tears the job down anyway).

Also raise the teardown-barrier timeout 3s -> 60s (overridable via
RCCL_TEST_TEARDOWN_TIMEOUT_SEC) so benign rank skew in heavy multi-phase
MPI tests (GrowMPITest, NetIbMPITest CtsDepthStress) no longer trips a
false 'out of sync' abort.

Test-harness only; no librccl behavior change. Recovers Grow_MultiRankJump
and NetIB_CtsDepthStress (ib-cast) from false failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JhaShweta1
JhaShweta1 requested a review from a team as a code owner July 27, 2026 19:48

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

Fixes RCCL MPI test-harness teardown behavior by removing an illegal MPI_Cancel of a nonblocking collective (MPI_Ibarrier) on timeout, and by increasing the teardown-barrier timeout to reduce false “out of sync” aborts in long/heavy multi-phase tests.

Changes:

  • Remove MPI_Cancel/MPI_Request_free on MPI_Ibarrier timeout and call MPI_Abort directly.
  • Increase default teardown-barrier timeout from 3s to 60s.
  • Add RCCL_TEST_TEARDOWN_TIMEOUT_SEC environment override and improve timeout diagnostics.
Comments suppressed due to low confidence (1)

projects/rccl/test/common/MPIEnvironment.cpp:255

  • Using std::atoi for RCCL_TEST_TEARDOWN_TIMEOUT_SEC is unsafe: it provides no error reporting and has undefined behavior on overflow. The test codebase already uses validated parsing via strtol (e.g., projects/rccl/test/NetSocketTests.cpp:574). Consider switching to std::strtol with end-pointer + ERANGE checks before updating timeout_sec.
        if(const char* env = std::getenv("RCCL_TEST_TEARDOWN_TIMEOUT_SEC"))
        {
            int v = std::atoi(env);
            if(v > 0) timeout_sec = v;
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// ncclCommDestroy is now explicitly called (and MPI-barrier'd) inside
// cleanupTestCommunicator before TearDown runs, so the common remaining rank
// skew here is log-file I/O (RCCL_MPI_LOG_ALL_RANKS). However, heavy
// multi-phase tests (e.g. GrowMPITest, NetIbMPITest CtsDepthStress) can have

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.

Did we see failures in these tests without this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes: GrowMPITest, NetIbMPITest are passing now.

@JhaShweta1
JhaShweta1 merged commit f180816 into users/corey-derochie-amd/aicomrccl-1281-sync-nccl-2.30.7 Jul 27, 2026
39 of 46 checks passed
@JhaShweta1
JhaShweta1 deleted the users/shwetjha/test_harness_fix branch July 27, 2026 21:20
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.

4 participants