mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4761] [Bug]: [Store] batch_get_into into GPU memory crashes (SIGSEGV) when the local hot cache is enabled #1213
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1213
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Jackmeson1 on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4761
Bug Report
On main
0e626c5,batch_get_intoandbatch_get_into_multi_bufferscrash the reading process with SIGSEGV when the destination is CUDA memory and the local hot cache is enabled (MC_STORE_LOCAL_HOT_CACHE_SIZE). With the default admission threshold the second read of a key crashes; withMC_STORE_LOCAL_HOT_ADMISSION_THRESHOLD=1the first one does. The same reads into pinned host memory,get_intointo CUDA memory, and the batch read into CUDA memory without the hot cache all succeed.The path, at
0e626c5:batch_get_intohands the caller's buffers, device pointers included, toClient::BatchGet; the multi-buffer path does the same (real_client.cpp:8137).BatchGetcallsProcessSlicesAsyncon those slices (client_service.cpp:1899, and :1646 inBatchGetWhenPreferSameNode), which submits every slice of a remote replica to the hot cache (client_service.cpp:5613-5634).SubmitPutTaskcopies the slice withstd::memcpy(block->addr, slice.ptr, slice.size), a host copy from a device pointer.IsHotCacheEnabled()(real_client.cpp:4701-4704). The batch paths have no such staging.Draft #4619 replaces that
memcpywithRuntimeAccelerators().CopyToHost(tested with a mocked accelerator), which looks like it would also fix this crash, although its description does not mention it. I'm filing the crash separately so it is tracked with a reproduction on a real GPU, whichever change lands.Environment
0e626c5, built with-DUSE_CUDA=ON(HTTP and etcd metadata, unit tests), CUDA 13mooncake_master, TCP transport,P2PHANDSHAKESteps to reproduce
Condensed from the script behind the results below (same calls and settings):
Output: attempt 0 reads the 65536 bytes correctly; the next
batch_get_intocall then dies withSegmentation fault(exit 139) inside the hot-cache admission copy, before the call returns. The copy runs synchronously inSubmitPutTask, before the fill task is queued.One recorded run per mode (the first four rows use
MC_STORE_LOCAL_HOT_ADMISSION_THRESHOLD=1; the batch CUDA case crashed again under gdb, which gave the backtrace above; with the default threshold, the batch CUDA case crashed on the second read as described):batch_get_intobatch_get_intoget_intobatch_get_intobatch_get_into_multi_buffersbatch_get_into_multi_buffersExpected behavior
A batch read into GPU memory with the hot cache enabled either fills the cache with a device-aware copy, as
get_intoeffectively does, or skips admission for device slices; it should not crash the process.This report was prepared with AI assistance (Claude Code); the reproduction was run on a real GPU against
0e626c5.@github-actions[bot] commented on GitHub (Oct 19, 2026):
Thanks for opening this issue, @Jackmeson1!
130693642A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@he-yufeng commented on GitHub (Oct 19, 2026):
Thanks for the precise report, @Jackmeson1 — the repro matrix (batch into CUDA crashes, single get_into into CUDA and pinned-host batch reads fine) pointed straight at the right layer.
Root cause: after a successful remote read,
Client::ProcessSlicesAsyncsubmits each destination slice to the hot cache viaLocalHotCacheHandler::SubmitPutTask, which copies into the cache block with a hoststd::memcpy(block->addr, slice.ptr, slice.size). For a CUDA destination that memcpy dereferences a device pointer on the host and the process dies in__memcpy_avx512_unaligned. The read side itself is fine — the local-memcpy worker pool is already device-aware, which is why single reads and disabled-cache reads survive.Fix is up: the writeback now probes each slice with the accelerator registry (the same
FindDeviceForPointerdiscriminator the checksum and DFS staging paths use) and skips device-resident slices instead of caching them. Regression test included: a fake accelerator claims a static buffer as device memory so the guard runs on CPU-only CI, with a host-destined control key in the same batch proving the writeback path itself still works.→ #4764