Mooncake/mooncake-store
lujh 3e7c78de9b
[Store] Fix segfault in disk-replica/offload paths when handling GPU pointers (#1892)
PutToLocalFile and FileStorage::OffloadObjects crash with SIGSEGV when
slice.ptr points to GPU device memory, because CPU memcpy cannot access
GPU virtual addresses. The RDMA memory-replica path is unaffected.

Add synchronous Device-to-Host staging via PinnedBufferPool before data
reaches the disk-write paths:

- New gpu_staging_utils.h: shared IsDevicePointer/CopyDeviceToHost/
  SetDevice helpers with cross-platform support (CUDA/HIP/MUSA/MACA/
  Ascend CANN)
- New PinnedBufferPool: thread-safe pinned host memory pool with
  max capacity limit (default 32) and O(1) swap-pop acquire
- PutToLocalFile: sync D2H on calling thread, PutRevoke on failure
- OffloadObjects: D2H staging before BatchOffload; on per-slice failure
  the entire object is skipped to prevent partial/corrupt data
- CMakeLists: auto-detect CUDAToolkit/HIP/Ascend independently of
  global USE_CUDA flag, with explicit PRIVATE compile definitions
- CI: add -lcudart to Go test CGO_LDFLAGS when CUDA is present

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 11:51:53 +08:00
..
benchmarks [Store] fix gmock bug and add batch remove API (#1756) 2026-03-31 16:55:41 +08:00
conf [Store] support resolving master RPC address from interface (#1784) 2026-04-01 12:39:05 +08:00
go [Store] Fix `with_hard_pin` failure in python API (#1873) 2026-04-12 23:22:23 +08:00
include [Store] Fix segfault in disk-replica/offload paths when handling GPU pointers (#1892) 2026-04-20 11:51:53 +08:00
rust [Store] Fix `with_hard_pin` failure in python API (#1873) 2026-04-12 23:22:23 +08:00
src [Store] Fix segfault in disk-replica/offload paths when handling GPU pointers (#1892) 2026-04-20 11:51:53 +08:00
tests [CI] fix: health_check_test flaky due to fixed sleep, use polling for master down detection (#1868) 2026-04-16 14:36:32 +08:00
CMakeLists.txt [STORE] add Redis leadership backend and HA regression coverage (#1722) 2026-03-25 01:03:56 +08:00