Skip to content

TEST/GTEST/UCT: Wait for device memory to be released - #12396

Open
tvegas1 wants to merge 3 commits into
openucx:masterfrom
tvegas1:gtest-rdma-mem-skip
Open

tvegas1 wants to merge 3 commits into
openucx:masterfrom
tvegas1:gtest-rdma-mem-skip

Conversation

@tvegas1

@tvegas1 tvegas1 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Wait up to 30 seconds for RDMA device memory when allocating test buffers, instead of retrying for about 50 ms in uct_atomic_key_reg_rdma_mem_type.fadd64.

Why

Device memory (128 KB) is shared by all processes on the host. Other CI jobs can hold all of it for several seconds, longer than the current 10 short retries, and the test then fails with "Out of memory". This is temporary contention rather than missing support, so the test should wait for the memory instead of failing or skipping.

How

  • In uct_test::entity::mem_alloc(), retry RDMA memory allocations while they return UCS_ERR_NO_MEMORY until a 30 second timeout. Other memory types keep a single attempt.
  • Remove the num_retries parameter, which only fadd64 used.
  • Print one message when waiting starts and one with the time waited, and hide the repeated allocation errors in between.
  • The test still fails if the memory is not released within the timeout, and still skips on devices without RDMA memory support.

@tvegas1
tvegas1 requested a review from a team as a code owner November 19, 2026 16:02
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread test/gtest/uct/uct_test.cc Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@tvegas1 tvegas1 changed the title TEST/GTEST/UCT: Skip when other processes hold all device memory TEST/GTEST/UCT: Wait for device memory to be released Nov 19, 2026
Comment thread test/gtest/uct/uct_test.cc Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: the new wait path can only be exercised on a host where RDMA/DM memory is actually exhausted by another process, so neither the success-after-wait nor the 30 s expiry branch is covered by CI. Worth confirming the author exercised the expiry branch manually (e.g. by temporarily forcing UCS_ERR_NO_MEMORY).

@svc-ucx

svc-ucx commented Nov 20, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer roce on worker 2) · commit 53b85ef9

TL;DR: The build never reached any test — the Azure Pipelines agent was externally terminated ("The agent has received a shutdown signal") at 09:57:20 while still compiling gtest sources, so this is an infrastructure/cancellation event, not a code or test failure. Re-run the AddressSanitizer roce on worker 2 job.

Full analysis

Summary: UCX PR (AddressSanitizer roce on worker 2) build 146395 was cancelled mid-compile during the Run ./contrib/test_jenkins.sh step; no gtest actually executed.

Root cause: Evidence from the job log:

  • From 2026-11-20T09:44:40 to 09:57:25 the log shows nothing but continuous g++ ... -fsanitize=address ... -c -o ucp/gtest-test_ucp_*.o compile lines for test/gtest, each a few seconds apart. The largest gap between consecutive lines is ~45 s (09:56:35 → 09:57:20), i.e. the job was making steady forward progress — not hung.
  • At 09:57:20.6962615 the log emits ##[error]The agent has received a shutdown signal. This can happen when the agent service is stopped, or a manually started agent is canceled., immediately followed by ##[error]The Operation will be canceled... and ##[error]The operation was canceled.
  • The last compile (ucp/gtest-test_ucp_tag_mt.o) was still started after the shutdown signal, confirming make was healthy and the kill came from outside the build.

So the failure is an agent-side termination (agent service stopped / pool VM reclaimed / build superseded-cancelled), not a defect introduced by commit 53b85ef9 on branch gtest-rdma-mem-skip. There is no compiler error, no linker error, no assertion, and no ASan report anywhere in the log — the ASan gtest binary was never even linked, let alone run.

Implicated commit: none — no code defect is visible in the log; the HEAD under test was [REDACTED:Hex High Entropy String] but it had not yet produced any test output when the agent died.

File: n/a (failure is in the CI agent lifecycle, not in a source file; the step was contrib/test_jenkins.sh, still inside the make of test/gtest)

Suggested fix:

  1. Simply re-queue build 146395 / re-trigger CI on PR TEST/GTEST/UCT: Wait for device memory to be released #12396 — an agent shutdown is retryable and carries no signal about the PR.
  2. If this recurs on the same worker, have the CI admins check the agent host backing worker 2 (agent service restarts, spot/preemptible VM eviction, OOM-killing of the agent process — the ASan -O3 -g g++ compiles of test/gtest are memory-hungry and can trip the host OOM killer, which would also manifest as an agent shutdown).
  3. Longer term, the ASan job spends >12 minutes purely compiling test/gtest before any test starts; enabling ccache or raising make -j for this pipeline would shrink the window in which a flaky/reclaimed agent can kill the build.

Related: none — the issue search returned only unrelated open PRs; no existing tracker for this agent-shutdown signature.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 15971a8b-e07a-4051-9d9f-37719d8a6fed in the triage console for the audit trail.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@tvegas1

tvegas1 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Worth confirming the author exercised the expiry branch manually (e.g. by temporarily forcing UCS_ERR_NO_MEMORY).

done, with local hacks failing the RDMA memory allocation on rc_mlx5/dc_mlx5:

  • failing all the time: the wait expires after 30 s and the test fails cleanly on ASSERT_UCS_OK(). with 53b85ef it aborted after 5924 hidden errors and killed the gtest process.
  • failing only for the first 3 s: waited ~3 seconds for memory: Success, and the test passed.
  • failing on the max_dm_size check, whose error ignores UCT_MD_MEM_FLAG_HIDE_ERRORS: 287 errors in 30 s, then a clean failure. with the 0-10 ms sleep it aborted after 1000.

do {
/* Do not repeat the allocation errors while waiting */
last = ucs_get_time() >= deadline;
params.flags = mem_flags |

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 host branch below still passes mem_flags to uct_iface_mem_alloc(), so UCT_MD_MEM_FLAG_HIDE_ERRORS is dropped there. pls pass params.flags in both branches, otherwise this silently stops working if the timeout is ever enabled for non-RDMA memory.

uct_md_h uct_md = md();
ucs_status_t status = UCS_OK;
/* Other processes on the host may hold all device memory for a while */
double timeout = (mem_type == UCS_MEMORY_TYPE_RDMA) ? 30.0 : 0.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.

can we scale by ucs::test_time_multiplier()? under valgrind the other process holding the device memory also runs ~20x slower, so a fixed 30 seconds may still be too short there.

@svc-ucx

svc-ucx commented Nov 20, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer BlueField on worker 0) · commit 965fd9d5

TL;DR: The AddressSanitizer BlueField job failed on a LeakSanitizer report (68 KB / 17 allocations, make test → Error 1), not on a test assertion: every leaked block was allocated inside test_ucp_proto_mock_rcx_speed_change.rma_get's init() — one mocked rc_mlx5 iface (devx RX buffer, both CQs, dbrec) and one uct_rc_mlx5_ep with its 64 KB QP — i.e. the UCT iface/endpoint created at test setup were never destroyed at teardown. This is in the UCP port-speed-change/ep-reconfiguration area touched by this week's master commits and is unrelated to PR #12396's UCT device-memory change.

Full analysis

Summary: gtest aborted the AddressSanitizer run with SUMMARY: AddressSanitizer: 68024 byte(s) leaked in 17 allocation(s), all leaks traced to the setup of test_ucp_proto_mock_rcx_speed_change.rma_get.

Root cause: From the leak stacks in the log, the leaked blocks are exactly one lane's worth of UCT state created during init():

  • uct_rc_mlx5_devx_init_rx_common (rc_mlx5_devx.c:233), uct_ib_mlx5_devx_create_cq (ib_iface.c:2038 and :2044), uct_ib_mlx5_get_dbrec → all via mock_iface::iface_open_mock → ucp_worker_iface_open → ucp_worker_create → ucp_test::init() (ucp_test.cc:116);
  • uct_rc_mlx5_ep_t_new + its 64 KB uct_ib_mlx5_devx_create_qp buffer and the ucp_wireup_ep stub iface → ucp_ep_create → test_ucp_proto_mock::connect() (test_ucp_proto_mock.cc:550, called from init() line 503).

So an iface and an endpoint allocated in setup outlived the test. Two mechanisms fit the evidence, both in the path this test exercises:

  1. The teardown path never ran for these objects. In the gtest harness m_initialized is only set after init() returns (test/gtest/common/test.cc:410-415) and cleanup() is called only if (m_initialized) (test.cc:431-433); any skip/abort exception thrown late in init() (e.g. UCS_TEST_SKIP_R from ucp_test_base::entity::connect, ucp_test.cc:750) silently leaks everything already created — which is what LSan reports here.
  2. The endpoint/iface were dropped during the EP reconfiguration that this test deliberately triggers (set_port_speed() → IBV_EVENT_DEVICE_SPEED_CHANGE → new EP/rkey configs, test_ucp_proto_mock.cc:5029-5035) and never destroyed — i.e. a discarded uct_ep that was not run through ucp_worker_discard_uct_ep_destroy_progress (src/ucp/core/ucp_worker.c:3222-3250, ucp_worker_destroy order at :3401-3402).

The truncated head of the log (the [ FAILED ]/[ SKIPPED ] line for the test) is needed to tell (1) from (2). Note PR #12396 ("TEST/GTEST/UCT: Wait for device memory to be released") does not touch UCP worker/ep/proto-mock code, so this is most likely a master-side regression or a pre-existing flake surfacing on the ASan BlueField worker.

Implicated commit: Not proven; prime suspects, all landing 2–3 days before this build and touching exactly the path-bandwidth → EP-config/worker-destroy machinery this test drives: 48795b8b "UCP: Keep measured path bandwidth per endpoint (#12334)" (dmitrygx), 4748c2a0 "UCP/RMA: Balance PUT fragments by measured path bandwidth (#12362)" (dmitrygx), f68fa5fc "UCP/CORE: Close endpoints by force on worker destroy (#12360)" (dmitrygx). The test itself was recently patched by 6f2c2dd3 (Alexey Rivkin).

File: test/gtest/ucp/test_ucp_proto_mock.cc:5116 (failing test, setup at :5003-5027 and :501-512) · test/gtest/common/test.cc:413,431 (cleanup skipped when init() throws) · src/ucp/core/ucp_worker.c:3401-3402

Suggested fix:

  1. Re-run just this test on a BlueField ASan node (./gtest --gtest_filter='*proto_mock_rcx_speed_change*rma_get*') and look at the lines before the LSan report: if it shows SKIPPED/aborted, the leak is a teardown gap — make test_ucp_proto_mock::init() exception-safe (create entities through an RAII/scope guard, or have TearDownProxy call cleanup() also when the state is SKIPPED/ABORTED after entities exist) so a late skip in init() cannot leak a UCP worker/ep.
  2. If the test actually ran, add an assertion in test_ucp_proto_mock_rcx_speed_change::cleanup() that worker->num_all_eps == 0 and kh_size(&worker->discard_uct_ep_hash) == 0 after set_port_speed()-driven reconfiguration, and audit the reconfiguration path from commits UCP: Keep measured path bandwidth per endpoint #12334/UCP/RMA: Balance PUT fragments by measured path bandwidth #12362 for a lane whose uct_ep is replaced without ucp_worker_discard_uct_ep()/uct_ep_destroy() (the leaked block is uct_rc_mlx5_ep from rc_mlx5_ep.c:2449 + its QP buffer).
  3. Short term, so the ASan gate isn't blocked for unrelated PRs: confirm the failure reproduces on master at 965fd9d's base and, if so, open an issue and temporarily skip the rma_get variant of test_ucp_proto_mock_rcx_speed_change on BlueField/ASan rather than re-triggering CI on PR TEST/GTEST/UCT: Wait for device memory to be released #12396.

Related: PR under test: #12396 · suspect commits: #12334, #12362, #12360 · prior fix to the same test: commit 6f2c2dd3 "UCP/GTEST: Fix expected rkey config count in port speed change test"

This branch has not been deployed

No deployments
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.

3 participants