Skip to content

fix: prevent UB stress transfer lifetime races - #16

Open
YChange01 wants to merge 1 commit into
zchuango:supercache_devfrom
YChange01:fix/ub-stress-coredump
Open

YChange01 wants to merge 1 commit into
zchuango:supercache_devfrom
YChange01:fix/ub-stress-coredump

Conversation

@YChange01

Copy link
Copy Markdown

Summary

  • keep an owned TransferRequest copy in each TransferTask instead of pointing at caller-owned vectors
  • defer UB successful completion publishing until the worker has finished local slice accounting
  • add a regression check for TransferTask request ownership

Test Plan

  • git diff --check
  • cmake -S . -B /private/tmp/mooncake-build -DBUILD_UNIT_TESTS=ON -DWITH_STORE=OFF -DWITH_STORE_RUST=OFF -DWITH_TE=ON -DUSE_ETCD=OFF -DUSE_HTTP=OFF -DUSE_REDIS=OFF (blocked locally: missing yalantinglibsConfig.cmake; extern/yalantinglibs submodule is not initialized)

@zchuango
zchuango force-pushed the supercache_dev branch 2 times, most recently from 41943c4 to ccf5499 Compare June 3, 2026 10:21
zchuango added a commit to liangxu2000/Mooncake that referenced this pull request Aug 1, 2026
…plica counts in PutStart (zchuango#16)

* [Store] Surface partial replica allocation in PutStart and document allocation semantics

(cherry picked from commit cc2298d, upstream PR kvcache-ai#3156)

* [Store] Add strict_replica_allocation flag to enforce exact memory replica counts

When --strict_replica_allocation=true (default false), memory-only multi-replica PutStart/UpsertStart must allocate exactly replica_num replicas; otherwise the request fails with NO_AVAILABLE_HANDLE (counted in put_start_alloc_failures and triggering async eviction) instead of silently degrading to fewer replicas. Default behavior is unchanged (best-effort with partial-allocation metric/log from the previous commit). Also fixes the ported PutStartPartialAllocationIsObservable test to use the plain string tenant id, since this branch has no TenantId type.

Tested: master_service_test 131/131 passed, master_metrics_test 10/10 passed (WSL, Debug build).

* [Store] Add test covering strict vs best-effort dual-replica degradation

Covers the exact behavior difference of strict_replica_allocation with the production baseline config (replica_num=2, no NoF): when only one replica is allocatable (single mounted segment), best-effort silently degrades to one replica (with partial-allocation metric), while strict mode fails with NO_AVAILABLE_HANDLE and counts an allocation failure.

---------

Co-authored-by: Chuang Zhang <zchuang185@gmail.com>
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.

1 participant