Skip to content

JUCX/TEST: Allow page-rounded memory allocations - #12211

Closed
shasson5 wants to merge 7 commits into
openucx:masterfrom
shasson5:jucx-allocation-length
Closed

shasson5 wants to merge 7 commits into
openucx:masterfrom
shasson5:jucx-allocation-length

Conversation

@shasson5

@shasson5 shasson5 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by #12311 as part of the combined Blossom fixes.

What?

Allow JUCX allocated memory regions to be larger than the requested length.

Why?

UCX can round allocations to the system page size. Requiring an exact length causes a false failure when the returned allocation satisfies the request but occupies a larger region.

HPCINFRA-5019

@shasson5
shasson5 requested a review from a team as a code owner November 2, 2026 17:32
@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

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

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Review complete — no issues found.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@shasson5

shasson5 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/build

@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

The loosened assertion now has no upper bound, so a pathological allocator returning a vastly oversized segment would pass silently. This is a theoretical gap only, since there is no API-level upper bound to assert against. Also note the fix is only exercised where JUCX tests run (contrib/test_jenkins.sh java tests); the originally failing configuration (non-4 KB page size or huge-page allocation) may not be represented in CI, so CI passing does not by itself prove the original failure is fixed — worth confirming with the author which platform reproduced it.

@svc-ucx

svc-ucx commented Nov 8, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX-OSS/ucx-test-gpu-oss · commit 05e74702

TL;DR: Both failing Test stages hung in test_ucp_rma_reg.get_blocking — large RMA GETs over IB with non-blocking/ODP memory registration never completed (3 × 180 s request timeouts, then gtest aborted with "Connection timed out"); the identical hang already occurred on master in build #70 on the same node (funk10), so it is not caused by PR #12211 and should be re-run / investigated as an ODP-registration hang on the funk nodes.

Full analysis

Summary: Stages Test (id 272, node funk10) and Test (id 287, node funk19) of build #72 aborted: ucp_get_nbx requests in test_ucp_rma_reg.get_blocking never completed, producing ucp_test.cc:310 UCX ERROR request ... did not complete on time, test_ucp_memheap.cc:115: Failure / data validation failed, and finally test_helpers.cc:57 Connection timed out - abort testing (SIGABRT, exit code 2).

Root cause: A hang, not a slow test. Timestamp analysis of stage 272 shows the last meaningful line is [ RUN ] rcx/test_ucp_rma_reg.get_blocking/1 <rc_x,cuda_copy,rocm_copy/nb> at 14:42:09, followed by silence until 14:45:16 (3 min), again to 14:48:22, 14:51:14, and finally a ~12 min gap to the 15:03:21 abort. Stage 287 is identical on shm_ib_ipc/test_ucp_rma_reg.get_blocking/2 <...no_devx>. The failing variants are exactly the ones that set UCX_REG_NONBLOCK_MEM_TYPES=host (nb = NON_BLOCK, no_devx = NON_BLOCK|NO_DEVX, see test/gtest/ucp/test_ucp_rma.cc:884-896), i.e. on-demand-paging (ODP) registration, and the hang happens on multi-hundred-KB/MB get_zcopy transfers after the smaller sizes passed. The same signature reproduced in build #70 (commit unrelated to this PR) on the same machine funk10, where shm_ib_ipc/test_ucp_rma.get_blocking/2 <user_memh> hung during the map_nb (UCP_MEM_MAP_NONBLOCK) pass with the same three 180 s timeouts and the same abort backtrace. So this is a recurring large-message RMA-GET-with-ODP stall on these GPU nodes, independent of the branch under test (PR #12211 only touches JUCX/test allocation rounding and cannot affect the IB GET path).

Implicated commit: unknown — not 05e7470 / PR #12211; the same failure exists on master (build #70, merge base of a different PR)

File: test/gtest/ucp/test_ucp_rma.cc:884 (NON_BLOCK / NO_DEVX variants of test_ucp_rma_reg); failure surfaces at test/gtest/ucp/test_ucp_memheap.cc:115

Suggested fix:

  1. Do not treat this as a PR JUCX/TEST: Allow page-rounded memory allocations #12211 regression — re-trigger the build; the PR's diff (JUCX page-rounded allocations) is not in the IB RMA path.
  2. Investigate the ODP path on the affected hosts: the GET request stalls forever while the NIC resolves page faults for REG_NONBLOCK (ODP) MRs. Check funk10/funk19 for ODP capability/driver state (DOCA 2.9 container, ibv_devinfo ODP caps, pagefault counters, dmesg for mlx5 page-fault errors) and whether the fabric/QP went into an error state; it is likely a node/driver-level ODP page-fault stall rather than UCX logic, since the non-ODP variants ("", no_rcache, gva, gva_no_rcache) passed on the same runs.
  3. CI hygiene: make the gtest harness dump UCT QP/CQ and protocol state (e.g. UCX_LOG_LEVEL=debug/ucp_ep_print_info) on the first "did not complete on time" instead of retrying silently for 3 × 180 s, and consider gating/known-flake marking of test_ucp_rma_reg.get_blocking NON_BLOCK variants until the ODP stall is root-caused, so unrelated PRs are not blocked.

Related: PR #12211 (branch under test, #12211 — not the cause); prior occurrence in job UCX-OSS/ucx-test-gpu-oss build #70, stage 254; possibly relevant to the registration-offset work in #12265 (also exercises test_ucp_rma_reg)

@svc-ucx

svc-ucx commented Nov 8, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX-OSS/ucx-test-dl-gpu-oss · commit 05e74702

TL;DR: All four parallel gtest shards of ucx-test-dl-gpu-oss #66 failed: two shards reported 45 and 54 failing tests, all of them in the buffer‑allocation/registration families (ib/test_md.reg*, uct_p2p_am_test, uct_p2p_rma_test*, test_ucp_mmap.rndv_mpool_mdesc_no_rcache, gdr_copy/cuda_ipc MD tests), and the other two shards aborted after a 15‑minute hang in dcx/test_ucp_tag_mt.send_recv. The failure set matches exactly what PR #12211 ("JUCX/TEST: Allow page‑rounded memory allocations", branch jucx-allocation-length) touches — the allocated/registered length is no longer identical to the requested length, breaking every gtest helper that assumes allocated == requested.

Full analysis

Summary: gtest stages 419, 306, 317 and 352 of build #66 all failed — two with mass test failures in memory allocation/registration tests, two with a hang in dcx/test_ucp_tag_mt.send_recv.

Root cause: Evidence from the stage logs:

  • Stage 419: 45 FAILED TESTS; stage 306: 54 FAILED TESTS. The failures are not random — they cluster in exactly the families that allocate and register buffers through the gtest allocation helpers (mem_buffer / uct_test::mapped_buffer): ib/test_md.reg/* and ib/test_md.reg_perf/* on every mlx5 device, uct_p2p_am_test.am_bcopy/am_zcopy/am_short*_keep_data for rc_mlx5/rc_verbs/dc_mlx5/ud_mlx5/ud_verbs, uct_p2p_rma_test.put_short/put_bcopy/put_zcopy/get_bcopy/get_zcopy, uct_p2p_rma_test_inlresp.*, uct_p2p_rma_test_alloc_methods.xfer_reg*, test_ucp_mmap.rndv_mpool_mdesc_no_rcache on all transports, plus gdr_copy/test_gdr_copy, gdr_copy/test_uct_query.query_perf and cuda_ipc/test_cuda_ipc_md.mnnvl_detection. Meanwhile ordinary data‑path tests (test_ucp_rma, test_ucp_tag_mem_type, rndv tests with multi‑MB messages) pass, so IB registration itself is not broken on the node — only the length bookkeeping is. This is the direct consequence of relaxing the allocation length to a page‑rounded value: the length the test records/registers/verifies no longer equals the length that was requested.
  • Logs also show p2p tests now driving absurd single‑buffer ranges, e.g. posix/uct_p2p_rma_test.put_bcopy/1 … memory_type:host 0 4402341478 1x{0..4402341478} (4.4 GB, 8.8 s) and gdr_copy/uct_p2p_rma_test.put_short/0 … memory_type:cuda 0 4294967295 (4.29 GB), while a normal case is gga_mlx5/uct_p2p_rma_test.get_zcopy/0 … 1 2097152 1x{1..2097152} — consistent with the max length being derived from a rounded/overflowed allocation size, which makes the equivalent IB registrations fail.
  • Stages 317 and 352 are a hang, not slowness: last application output [ RUN ] dcx/test_ucp_tag_mt.send_recv/0 at 15:39:03, then total silence until 15:54:10 (test/gtest/common/test_helpers.cc:57: Failure / Connection timed out - abort testing, SIGABRT with libgomp frames). Identical 15‑minute gap in stage 352 (16:15:33 → 16:30:40 on send_recv/1). So the multi‑threaded tag test deadlocked waiting for a completion that never arrived — do not raise the job time limit for this.

Implicated commit: [REDACTED:Hex High Entropy String] — PR #12211 "JUCX/TEST: Allow page‑rounded memory allocations" (branch jucx-allocation-length); author not resolvable from the fetched logs. No pre‑existing issue/PR describes these failures, and build #65 died in Checkout source code, so there is no clean baseline in this job.

File: test/gtest/common/mem_buffer.cc / test/gtest/common/mem_buffer.h:138‑153 (requested vs. allocated size) and the consumers that assume they are equal: test/gtest/uct/test_md.cc, test/gtest/uct/uct_p2p_test.cc, test/gtest/ucp/test_ucp_mmap.cc (rndv_mpool_mdesc_no_rcache); hang site: test/gtest/ucp/test_ucp_tag.cc (test_ucp_tag_mt.send_recv), aborted from test/gtest/common/test_helpers.cc:57.

Suggested fix:

  1. Keep the requested length authoritative in the shared gtest helpers: store both m_size (requested) and the page‑rounded allocated size, and use the requested size for registration, max‑length computation and pattern fill/compare. Do not let the rounded size leak into mem_buffer::size() / mapped_buffer length, which all UCT/UCP p2p and MD tests consume.
  2. Scope the page‑rounding to the JUCX (bindings/java) allocation path that the PR actually targets, instead of changing the common allocation helper used by the whole gtest suite.
  3. Separately debug the dcx/test_ucp_tag_mt.send_recv deadlock — run that single test under the new allocation path with UCX_LOG_LEVEL=debug and grab a stack dump of the OpenMP worker threads; the 4 GB‑scale page‑rounded buffers seen in the p2p logs are a likely trigger.
  4. Re‑trigger the job on master (or rebase) to get a clean baseline, since build UCP: link ucp with uct. #65 never ran the tests, and confirm none of the 45/54 failures are pre‑existing on these GB200 nodes.

Related: #12211 (the PR under test); no existing issue matches these failures or the test_ucp_tag_mt hang.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 698fed1a-337c-4817-9f62-fe0cb9ce63cd in the triage console for the audit trail.

@svc-ucx

svc-ucx commented Nov 8, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer roce on worker 1) · commit 05e74702

TL;DR: The only failure in the whole 8960-test ASAN run is ib/test_md.alloc/0 (mlx5_0), which exercises the IB MD's sole allocatable memory type — on-HCA device memory (ibv_alloc_dm) — a scarce per-device resource that transiently runs out when gtest parallel workers share the node; it is unrelated to this PR (which only touches JUCX Java tests) and should be retriggered, with the test hardened for RDMA/DM memory.

Full analysis

Summary: gtest job "AddressSanitizer roce on worker 1" failed with exactly one failing test — ib/test_md.alloc/0, where GetParam() = mlx5_0 — causing make test to exit with error 1.

Root cause: Evidence from the log: [ PASSED ] 8959 tests. / [ FAILED ] ib/test_md.alloc/0 / make: *** [Makefile:4992: test] Error 1. There is no hang (timestamps are continuous, largest gap ~1s) and no ASAN report — it is a single assertion failure.

For the ib component, UCT_MD_FLAG_ALLOC is only set when DEVX device memory (DM) is usable (uct_ib_mlx5dv_check_dm_ksm_reg, src/uct/ib/mlx5/dv/ib_mlx5dv_md.c:2311), and uct_ib_mlx5_devx_md_query then advertises alloc_mem_types |= UCS_BIT(UCS_MEMORY_TYPE_RDMA) with max_alloc = max_dm_size (ib_mlx5dv_md.c:3190-3193). So test_md.alloc loops 300 times calling uct_mem_alloc() → uct_ib_mlx5_devx_device_mem_alloc() → ibv_alloc_dm() on the HCA's on-device memory, which is a global, few-hundred-KB, cross-process resource. When it is exhausted the path returns UCS_ERR_NO_MEMORY (ib_mlx5dv_md.c:2162-2186), and the test only tolerates fewer than 50% such failures:

EXPECT_LT((double)num_alloc_failures / iterations, 0.5) << "Too many OUT_OF_RESOURCE failures";

(test/gtest/uct/test_md.cc:559). The test itself already whitelists "failed to allocate" / "exceeds maximal supported size" log messages (test_md.cc:466), confirming this DM path is a known transient-failure source. The run is on a shared ROCE node with parallel gtest workers ("roce on worker 1"), so concurrent DM consumption (or a transient KSM/atomic-mkey creation failure in uct_ib_mlx5_devx_reg_atomic_key during mkey_pack_v2 at test_md.cc:551) trips this.

Nothing in PR #12211 ("JUCX/TEST: Allow page-rounded memory allocations", branch jucx-allocation-length) touches UCT/IB or the MD allocation path, and src/uct/ib/base/ib_md.c / test/gtest/uct/test_md.cc have no recent commits that could explain this — so this is a pre-existing, environment-dependent flake, not a regression from the PR.

Implicated commit: unknown — not attributable to 05e7470 / PR #12211; no recent commit touches the IB MD alloc path or this test.

File: test/gtest/uct/test_md.cc:479-561 (failure assertion at test_md.cc:559), with the failing allocation in src/uct/ib/mlx5/dv/ib_mlx5dv_md.c:2134-2186

Suggested fix:

  1. Retrigger the Azure "roce on worker 1" job — the failure is independent of the PR diff.
  2. Harden the test so a scarce device memory pool can't fail it: in test_md.alloc, when the memory type is UCS_MEMORY_TYPE_RDMA, either skip the num_alloc_failures / iterations < 0.5 check or convert it to UCS_TEST_SKIP_R("device memory exhausted"), and/or shrink max_size for DM (e.g. cap to max_alloc / iterations) so parallel gtest workers on the same HCA can't starve each other.
  3. To get a definitive assertion line next time, keep the full gtest stdout as a build artifact — the current log tail truncates the failing test's output, leaving only the summary.

Related: PR #12211 (the triggering PR, unrelated to the failure); no existing issue found for ib/test_md.alloc flakiness — worth opening one.

.setLength(MEM_SIZE).nonBlocking());
assertEquals(allocatedMemory.getLength(), MEM_SIZE);
// UCP may round the allocation size up to a page-size multiple.
assertTrue(allocatedMemory.getLength() >= MEM_SIZE);

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.

Maybe more specific page-size assert?

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.

it requires page size query which is deprecated - #12211 (comment)

@svc-ucx

svc-ucx commented Nov 8, 2026

Copy link
Copy Markdown

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

TL;DR: The "commit title" codestyle job failed because PR #12211 contains an auto-generated revert commit titled Revert "CI: Temporarily isolate the JUCX allocation regression", which doesn't match UCX's required MODULE: Description title regex; reword (or drop) that commit.

Full analysis

Summary: Azure Pipelines stage Codestyle → job commit title exited with code 1 after codestyle_check_commit_title rejected one of the six commits in the PR.

Root cause: The job runs codestyle_check_commit_title "$base..$head" which validates every non-merge commit title against the regex ^[0-9A-Z/_-]+:\ [[:alnum:]_] (i.e. an uppercase module prefix, a colon, a space, then an alphanumeric word). Commit b8ab1973 was created with git revert, so its title is Revert "CI: Temporarily isolate the JUCX allocation regression". The leading token is Revert — lowercase letters and no colon — so the regex does not match and the script returns 1:

Bad commit title: 'Revert "CI: Temporarily isolate the JUCX allocation regression"'
Good commit title: 'CI: Temporarily isolate the JUCX allocation regression'
Good commit title: 'JUCX/TEST: Accept page-rounded allocation lengths'
...
##[error]Bash exited with code '1'.

The other five commits in the branch all passed, confirming this is a single bad title, not a tooling regression. Note the script is also missing set -e protection subtleties but behaves correctly here — this is a genuine contributor-side style violation, not a CI infrastructure bug.

Implicated commit: [REDACTED:Hex High Entropy String] — Shachar Hasson, "Revert "CI: Temporarily isolate the JUCX allocation regression"" (the checker itself is cfd9cd1f, Yossi Itigin, unchanged behavior)

File: buildlib/tools/codestyle.sh:14 (the title regex); offending commit title from b8ab1973

Suggested fix: Rewrite the branch history so the title follows the convention. Preferred option, since 433204bf ("CI: Temporarily isolate the JUCX allocation regression") and its revert b8ab1973 cancel each other out — drop both with an interactive rebase so the PR contains only the four JUCX/TEST: commits:

git rebase -i <base>   # drop 433204bf and b8ab1973
git push --force-with-lease

If the revert must be kept as a separate commit, reword it to carry a module prefix, matching the existing convention seen in PR #12207 (UCT/IB: Revert Allow ODP with DDP ...):

CI: Revert "Temporarily isolate the JUCX allocation regression"

Separately, if the project wants git revert-generated titles to be accepted automatically, codestyle_check_commit_title could strip a leading Revert " / trailing " before matching, e.g. title=${title#Revert \"}; title=${title%\"} — but that is a policy change and should be a separate PR, not a workaround for this failure.

Related: PR #12211 (this PR); PR #12207 "UCT/IB: Revert Allow ODP with DDP for FW >= 49.1014" (example of a correctly-prefixed revert title); checker introduced/limited in #11527 (cfd9cd1f)

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 24d4d60f-32f5-499e-9ca4-c15053bcd482 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.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Review complete — no issues found.

@shasson5
shasson5 force-pushed the jucx-allocation-length branch from b8ab197 to ea7e49a Compare November 9, 2026 16:50
@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 Nov 10, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests new on worker 1) · commit ea7e49aa

TL;DR: The gtest job failed on a single test, tcp/test_ucp_rma.put_nonblocking/0 <tcp,cuda_copy,rocm_copy/flush_worker>, with a "data validation failed" assertion — a known multi-lane flush bug where the remaining RMA lanes are abandoned once a flush is already pending on one lane, so ucp_worker_flush returns before all puts have landed. It is unrelated to PR #12211 (a Java-test-only change); the fix is already proposed in PR #12266.

Full analysis

Summary: make test in the "Tests new on worker 1" job exited 2 because 1 of 8964 gtests failed: tcp/test_ucp_rma.put_nonblocking/0, where GetParam() = tcp,cuda_copy,rocm_copy/flush_worker (log line 2026-11-10T01:23:23.1275582Z, make: *** [Makefile:5014: test] Error 1).

Root cause: The failing variant posts a series of non-blocking ucp_put_nbx calls (put_nbi, request released immediately), then relies on flush_worker(sender()) before byte-comparing the target buffer (test/gtest/ucp/test_ucp_memheap.cc:102-116 → ADD_FAILURE() << "data validation failed"). test_ucp_rma forces MAX_RMA_LANES=2, so the TCP endpoint has two RMA lanes. In ucp_ep_flush_progress(), once a flush has been queued on one lane (req->send.lane != UCP_NULL_LANE), any other lane that returns UCS_ERR_NO_RESOURCE is not added to pending and the lane loop breaks out (src/ucp/rma/flush.c:189-196), and the pending lane is also masked out of next_lanes (src/ucp/rma/flush.c:159-162). The resume path in ucp_ep_flush_progress_pending() only reschedules the slow path after calling ucp_flush_check_completion() and clears req->send.lane last (src/ucp/rma/flush.c:442-459), so the second lane's flush can be skipped and the worker flush reported complete while TCP still has unsent/unacked put data — hence the byte mismatch. This is a pre-existing race on master, not a regression from this PR: PR #12211 ("JUCX/TEST: Allow page-rounded memory allocations") only touches Java test code and cannot affect the C ucp_put_nbx/flush path. There are no large timestamp gaps in the log (test ran 2832 s with continuous output), so this is a genuine assertion failure, not a hang or timeout.

Implicated commit: d513f98f — nbellalou, "UCP/FLUSH: Add topology-safe selective endpoint flush (#11923)", 2026-10-25 (introduced the per-lane lane_mask / pending-lane ownership logic in ucp_ep_flush_progress). Not ea7e49aa (the PR head).

File: src/ucp/rma/flush.c:189-196 (lane loop break when a flush is already pending) and src/ucp/rma/flush.c:442-459; failure surfaces at test/gtest/ucp/test_ucp_memheap.cc:115.

Suggested fix: Do not abandon the remaining lanes when a flush is already pending on another lane — instead of break, continue to the next lane and reschedule the slow-path resume so every lane in lane_mask eventually gets uct_ep_flush(), and clear req->send.lane before calling ucp_ep_flush_progress()/ucp_flush_check_completion() in ucp_ep_flush_progress_pending() so the just-flushed lane does not block the others. This is exactly what PR #12266 implements; rebase/merge that fix rather than changing anything in PR #12211. In the meantime, re-run the job — this PR's diff is Java-test-only and the failure is an unrelated known flake.

Related: #12266 (UCP/FLUSH: Flush the other lanes after the pending lane), #11923 (topology-safe selective endpoint flush), #12211 (this PR)

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.

4 participants