Skip to content

[Bugfix][TransferEngine] Initialize descriptor fields compared on refresh - #63

Open
Connor-Matthew wants to merge 2 commits into
mainfrom
ci/community-20261129-metadata-init
Open

Connor-Matthew wants to merge 2 commits into
mainfrom
ci/community-20261129-metadata-init

Conversation

@Connor-Matthew

@Connor-Matthew Connor-Matthew commented Nov 29, 2026 •

Copy link
Copy Markdown

Description

SegmentDesc::operator== drives the same-version "conflicting metadata" check in syncSegmentCache() / refreshCachedSegment(). decodeSegmentDesc() never assigns BufferDesc::offset for non-CXL segments (nor DeviceDesc::lid for ub segments), so each decode leaves those members indeterminate. Two decodes of the same published JSON can then compare unequal, and a strict refresh of an unchanged descriptor is rejected with ERR_METADATA (-200). This breaks the refresh_session path added in kvcache-ai#5194 and turns nightly-coverage red on TransferMetadataStaleSegmentInvalidationTest.StrictRefresh* under ASan.

Default both scalars to zero. The CXL decode path still assigns offset explicitly and the RDMA/ascend paths still assign lid, so published content is unchanged.

Relevant run: nightly Nightly Build & Test 46163419233 (nightly-coverage, sha d936855e).

Suggested Merge Priority

  • P0 — Urgent
  • P1 — High
  • P2 — Normal

Module

  • Transfer Engine (mooncake-transfer-engine)

Type of Change

  • Bug fix

How Has This Been Tested?

Built transfer_metadata_test with the nightly sanitizer configuration
(-DENABLE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug) and ran the hardware-free suites:

cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON \
  -DWITH_STORE=OFF -DWITH_CONDUCTOR=OFF
cmake --build build --target transfer_metadata_test -j
./build/mooncake-transfer-engine/tests/transfer_metadata_test \
  --gtest_filter='TransferMetadataStaleSegmentInvalidationTest.*:TransferMetadataInvalidationTest.*'
  • Before the change: the three StrictRefresh* cases fail with
    Rejecting conflicting segment metadata with unchanged version and
    refreshCachedSegment() == -200, reproducing the nightly failure.
  • Field-level diagnosis at the rejection point showed only
    buffers[0].offset differs between the two decodes (garbage values such as
    35184346872120 vs 187650824490924); every other compared field matches.
  • After the change: all 12 tests in the two hardware-free suites pass
    ([ PASSED ] 12 tests.).
  • Mutation check: reverting the two initializers restores the original failure.

The remaining tests in transfer_metadata_test need an etcd metadata server, so
the full binary was not run locally.

Test results:

  • Unit tests pass
  • Integration tests pass (if applicable)
  • Manual testing done (describe below)

Checklist

  • Every commit I contribute includes my Signed-off-by trailer certifying the DCO
  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit on the files changed in this PR and all hooks pass
  • I have updated the documentation (if applicable)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specify below)

AI tools were used to help locate the failing field and draft the two-line
initializer change; the submitter reviewed the diff and ran the verification
above end to end.

…resh

decodeSegmentDesc() leaves BufferDesc::offset unset for non-CXL segments
and DeviceDesc::lid unset for ub segments, so a decoded SegmentDesc holds
indeterminate values in members that SegmentDesc::operator== reads. Two
decodes of the same published JSON can then disagree, and the strict
same-version check in refreshCachedSegment() rejects an unchanged
descriptor as a conflict (ERR_METADATA). The nightly
TransferMetadataStaleSegmentInvalidationTest.StrictRefresh* cases fail
under ASan for this reason.

Default both fields to zero; their decode paths still set them where they
carry meaning.

Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
@github-actions github-actions Bot added Transfer Engine size/S 0-99 changed lines (additions + deletions) labels Nov 29, 2026
Keep absent protocol-specific fields deterministic during metadata refresh.
Cover refreshing an unchanged CXL descriptor without a buffer address.

Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S 0-99 changed lines (additions + deletions) Transfer Engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant