Skip to content

UCP/WIREUP: fix worker flush hang from recovery wireup ep - #11988

Merged
gleon99 merged 3 commits into
openucx:masterfrom
ZhenlongMa:bug-fix/failover_hang
Oct 2, 2026
Merged

gleon99 merged 3 commits into
openucx:masterfrom
ZhenlongMa:bug-fix/failover_hang

Conversation

@ZhenlongMa

Copy link
Copy Markdown
Contributor

What?

Fix a hang in ucp_worker_flush() that occurs while a UCP endpoint lane is undergoing recovery.

Why?

Applications calling ucp_worker_flush() while a lane is mid-recovery would stall indefinitely, even though the recovery itself was progressing normally and no actual outstanding operation was blocking it.

How?

  • Added UCP_WIREUP_EP_FLAG_TRACK_FLUSH segment in wireup ep, set by default at ucp_wireup_ep_t construction to preserve the behavior for the normal wireup path).
  • Added ucp_wireup_ep_untrack_flush() in wireup_ep.c to clear the flag for recovery wireup ep.
  • Added a gtest case test_ucp_fault_tolerance.worker_flush_during_recovery.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/wireup/wireup_ep.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: the new test only runs on RC/IB with the pure-AM variant (skip_unless_rc_probe_gate()), so the fix is not exercised on non-IB CI configurations.

@svc-ucx

svc-ucx commented Sep 27, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (WireCompat Test wire compatibility gpu ucx_1_16) · commit 850d6eab

TL;DR: The wire-compat test aborted (exit 134) because the PR's new UCP_WIREUP_EP_FLAG_TRACK_FLUSH flag is set at wireup-EP construction but is not excluded from the debug assertion in ucp_wireup_ep_destroy_next_ep(), so ucs_assert((wireup_ep->flags & ~UCP_WIREUP_EP_FLAG_SEND_CLIENT_ID) == 0) always fires; widen the assert mask (or untrack flush before destroying next_ep).

Full analysis

Summary: ucp_client_server with UCX v1.16.x (and the "no sm" variant) crashed on the PR-built (v1.24.0) client side with wireup_ep.c:633 Assertion '(wireup_ep->flags & ~UCP_WIREUP_EP_FLAG_SEND_CLIENT_ID) == 0' failed → SIGABRT, Bash exit code 134.

Root cause: Commit [REDACTED:Hex High Entropy String] ("UCP/WIREUP: fix worker flush hang from recovery wireup ep") introduced UCP_WIREUP_EP_FLAG_TRACK_FLUSH = UCS_BIT(5) (src/ucp/wireup/wireup_ep.h:38) and sets it unconditionally in the class init: self->flags = UCP_WIREUP_EP_FLAG_TRACK_FLUSH; (src/ucp/wireup/wireup_ep.c:463). It is only cleared by ucp_wireup_ep_untrack_flush() / the cleanup func. The pre-existing sanity assert in ucp_wireup_ep_destroy_next_ep() requires that after clearing LOCAL_CONNECTED no flags other than SEND_CLIENT_ID remain, so any call to ucp_wireup_ep_destroy_next_ep() while flush is still being tracked trips the assert. The log shows this happens deterministically on the client immediately after lane selection (ucp_worker.c:2044 ... intra-node cfg#2 tag(rc_mlx5/mlx5_0:1) ka(rc_mlx5/mlx5_0:1)), i.e. during normal wireup/EP reconfiguration — not a real wire-compatibility problem (the 1.16 server side is fine; both PR steps fail identically, in both sm and ^sm configs).

Implicated commit: [REDACTED:Hex High Entropy String] — Zhenlong Ma, "UCP/WIREUP: fix worker flush hang from recovery wireup ep"

File: src/ucp/wireup/wireup_ep.c:633 (flag introduced at src/ucp/wireup/wireup_ep.c:463, defined at src/ucp/wireup/wireup_ep.h:38)

Suggested fix: Exclude the new flag from the assertion, e.g.:

wireup_ep->flags &= ~UCP_WIREUP_EP_FLAG_LOCAL_CONNECTED;
ucs_assert((wireup_ep->flags & ~(UCP_WIREUP_EP_FLAG_SEND_CLIENT_ID |
                                 UCP_WIREUP_EP_FLAG_TRACK_FLUSH)) == 0);

(cleanest is to define a UCP_WIREUP_EP_FLAGS_PERSISTENT mask used by this assert). Alternatively, if the intent is that flush tracking must already be released at that point, call ucp_wireup_ep_untrack_flush() on the relevant paths before ucp_wireup_ep_destroy_next_ep() — but note the flag is set for every wireup EP at construction, so masking is almost certainly the correct change. Also add an assert message printing flags to ease future triage, and re-run the release-mode + debug wire-compat jobs.

Related: PR #11988 (this PR); prior work on the same file: #11563, #11562

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 1c3bcc2c-56e1-495e-a41e-8a336be3c002 in the triage console for the audit trail.

@ZhenlongMa
ZhenlongMa force-pushed the bug-fix/failover_hang branch from 850d6ea to 52fa4c8 Compare September 28, 2026 02:23
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@svc-nvidia-pr-review

Copy link
Copy Markdown

src/ucp/wireup/wireup_ep.c

minor: trailing whitespace at end of line.

    ucs_assert((wireup_ep->flags & ~(UCP_WIREUP_EP_FLAG_SEND_CLIENT_ID |
                                     UCP_WIREUP_EP_FLAG_TRACK_FLUSH)) == 0);

@ZhenlongMa
ZhenlongMa force-pushed the bug-fix/failover_hang branch from 52fa4c8 to d2cf095 Compare September 28, 2026 02:57
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/core/ucp_ep.c Outdated
return status;
}

/*

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The proxy can also hold pending wireup messages (pending_count), which are not counted in flush_ops_count, and ucp_wireup_eps_progress() keeps the proxy alive until they drain. Can worker flush now complete while a LANES_ADDR/ACK is still queued on this lane?


m_held_probe_comp = NULL;

ucs::mock mock;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe move the mock setup + failure injection + wait-for-probe-in-flight sequence into a helper shared with teardown_with_outstanding_probe? The first ~15 lines of both tests are identical.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap (already reported on an earlier revision): the new test only runs on the pure-AM IB variant via skip_unless_rc_probe_gate().

@ZhenlongMa
ZhenlongMa marked this pull request as ready for review September 29, 2026 07:34
@evgeny-leksikov
evgeny-leksikov self-requested a review September 29, 2026 07:47
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@svc-ucx

svc-ucx commented Sep 29, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Build build_aarch64 rhel100_aarch64) · commit 7c783614

TL;DR: The aarch64 build failed compiling test/gtest/ucp/test_ucp_fault_tolerance.cc — a botched edit in the PR's head commit left two orphaned leftover lines (997–998) from a replaced ASSERT_TRUE(...) call; delete them.

Full analysis

Summary: make failed in test/gtest with -Werror=unused-value / expected ';' before ')' token at test/gtest/ucp/test_ucp_fault_tolerance.cc:997, aborting the build_aarch64 rhel100_aarch64 job (make: *** [Makefile:675: all] Error 2).

Root cause: Not an environment or aarch64-specific issue — plain source corruption. In test_ucp_fault_tolerance::worker_flush_during_recovery, the assertion was rewritten to use ucs::get_deadline(5.0):

995: ASSERT_TRUE(wait_for_recovery_probe_in_flight(ep, ucs::get_deadline(5.0)))
996:         << "could not catch an aux recovery probe in flight";
997:         ep, ucs_get_time() + ucs_time_from_sec(5.0)))   <-- leftover
998:         << "could not catch an aux recovery probe in flight";  <-- leftover

Lines 997–998 are the tail of the old call that was not deleted. After the ; on line 996, the compiler parses ep, ucs_get_time() + ucs_time_from_sec(5.0) as a stray comma expression (hence left operand of comma operator has no effect and value computed is not used, both fatal under -Wall -Werror) and then hits an unmatched ). Any compiler/arch would fail here; aarch64 just happened to be the reported job.

Implicated commit: 7c783614 — "Update test/gtest/ucp/test_ucp_fault_tolerance.cc", Zhenlong Ma (2026-09-29, the PR head commit)

File: test/gtest/ucp/test_ucp_fault_tolerance.cc:997-998

Suggested fix: Delete the two orphaned lines so the block reads:

    ASSERT_TRUE(wait_for_recovery_probe_in_flight(ep, ucs::get_deadline(5.0)))
            << "could not catch an aux recovery probe in flight";

    void *flush_req = sender().flush_worker_nb(0);

Also worth a quick consistency pass: the sibling assertion at lines 962–964 still uses the raw ucs_get_time() + ucs_time_from_sec(5.0) form while this one now uses ucs::get_deadline(5.0) — pick one idiom (ucs::get_deadline) for both. Build locally (make -C test/gtest) before re-pushing, since this breaks every build job, not just aarch64.

Related: PR #11988 (branch bug-fix/failover_hang); prior work on this test: d2cf095f (UCP/WIREUP: fix worker flush hang from recovery wireup ep), db208ee4 (#11563), 9db2e488 (#11562)

@ZhenlongMa
ZhenlongMa force-pushed the bug-fix/failover_hang branch from 7c78361 to 77805b5 Compare September 29, 2026 12:41
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@svc-ucx

svc-ucx commented Sep 29, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Codestyle commit title) · commit 77805b5b

TL;DR: This isn't a code/product bug — the "commit title" codestyle job failed because PR #11988 contains a commit titled Update test/gtest/ucp/test_ucp_fault_tolerance.cc (a GitHub web-editor default message) which doesn't match the required MODULE: description format; rename/squash that commit.

Full analysis

Summary: Azure Pipelines job "Codestyle → commit title" (build 137460) exited with code 1 after codestyle_check_commit_title rejected one of the PR's commit titles.

Root cause: The check in buildlib/tools/codestyle.sh iterates over every non-merge commit in base..head and requires the title to match the regex ^[0-9A-Z/_-]+:\ [[:alnum:]_] (i.e. an uppercase module prefix followed by : and a word). The log shows two commits in the PR:

  • Bad commit title: 'Update test/gtest/ucp/test_ucp_fault_tolerance.cc' — no MODULE: prefix, so err=1 and the bash step exits non-zero.
  • Good commit title: 'UCP/WIREUP: fix worker flush hang from recovery wireup ep' — passes.

The offending title is the auto-generated message GitHub creates when a file is edited through the web UI. No infrastructure problem, no timeout, no hang — the step ran in under a second (12:42:53.55 → 12:42:53.59).

Implicated commit: The PR commit titled Update test/gtest/ucp/test_ucp_fault_tolerance.cc on branch bug-fix/failover_hang (PR head [REDACTED:Hex High Entropy String]); the checked merge commit was 74acb8a32.

File: buildlib/tools/codestyle.sh:14 (the title regex); enforced by buildlib/pr/codestyle.yml:24

Suggested fix: Rewrite the bad commit title to follow the convention, e.g.:

git rebase -i [REDACTED:Hex High Entropy String]   # reword the offending commit
# new title, e.g.:
#   UCP/TEST: update fault tolerance gtest
git push --force-with-lease

Or simply squash it into the UCP/WIREUP: fix worker flush hang from recovery wireup ep commit (git reset --soft HEAD~2 && git commit -C <good-commit>), then force-push. Avoid committing via the GitHub web editor, which generates Update <path> titles that always fail this gate.

Related: Guidance referenced by the job: https://github.com/openucx/ucx/wiki/Guidance-for-contributors#general-guidelines — PR: #11988

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 6866ad92-e57a-4625-8631-ea568f55fd5c in the triage console for the audit trail.


if (self->flags & UCP_WIREUP_EP_FLAG_TRACK_FLUSH) {
UCS_ASYNC_BLOCK(&worker->async);
ucp_worker_flush_ops_count_add(worker, -1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: can we call the new helper here instead of duplicating the count update?

Suggested change
ucp_worker_flush_ops_count_add(worker, -1);
if (self->flags & UCP_WIREUP_EP_FLAG_TRACK_FLUSH) {
ucp_wireup_ep_untrack_flush(&self->super.super);
}
}

The local worker variable then becomes unused and can be dropped.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap (already reported on earlier revisions): the new test only runs on the pure-AM IB variant via skip_unless_rc_probe_gate().

Signed-off-by: Zhenlong Ma <zhenlongm@nvidia.com>
@ZhenlongMa
ZhenlongMa force-pushed the bug-fix/failover_hang branch from 77805b5 to cfc1236 Compare September 29, 2026 12:51
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Review complete — no issues found.

@svc-ucx

svc-ucx commented Sep 29, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests roce on worker 3) · commit cfc1236c

TL;DR: The only failing test is the new/racy rcx/test_ucp_fault_tolerance.probe_gated_recovery/6, which fails its EXPECT_TRUE(probe_armed) check because it samples the aux-probe state (recovery_arg->probe[lane].comp.func) only between short_progress_loop() calls and stops as soon as failed_lanes == 0 — so a probe that is armed and reset inside one progress round (

Comment thread src/ucp/core/ucp_ep.c Outdated
Comment on lines +1849 to +1859
* The failed transport EP and requests queued on the proxy are accounted
* separately, so the idle proxy itself must not block worker flush.
*/
ucp_wireup_ep_untrack_flush(wireup_ep_uct);

@evgeny-leksikov evgeny-leksikov Sep 30, 2026 •

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.

adding boolean parameter to ucp_wireup_ep_create could simplify the code

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.

fixed

@evgeny-leksikov evgeny-leksikov 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.

nice catch!

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/core/ucp_ep.c
}

status = ucp_wireup_ep_create(ep, &wireup_ep_uct);
/* The stub wireup endpoint which is vailing for recovery should not block

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: typo in the new comment, vailing -> waiting.

Suggested change
/* The stub wireup endpoint which is vailing for recovery should not block
/* The stub wireup endpoint which is waiting for recovery should not block
* worker flush. */

wireup_ep->flags &= ~UCP_WIREUP_EP_FLAG_LOCAL_CONNECTED;
ucs_assert((wireup_ep->flags & ~UCP_WIREUP_EP_FLAG_SEND_CLIENT_ID) == 0);
ucs_assert((wireup_ep->flags & ~(UCP_WIREUP_EP_FLAG_SEND_CLIENT_ID |
UCP_WIREUP_EP_FLAG_BLOCK_WORKER_FLUSH)) == 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: the second line of the updated assert is 83 columns, exceeding the 80-column limit from docs/CodeStyle.md ("Up to 80 columns").

Suggested change
UCP_WIREUP_EP_FLAG_BLOCK_WORKER_FLUSH)) == 0);
ucs_assert((wireup_ep->flags &
~(UCP_WIREUP_EP_FLAG_SEND_CLIENT_ID |
UCP_WIREUP_EP_FLAG_BLOCK_WORKER_FLUSH)) == 0);

@gleon99 gleon99 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.

👍🏼

@gleon99
gleon99 merged commit b904de4 into openucx:master Oct 2, 2026
162 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants