[GH-ISSUE #4386] store: UdsAcceptor::listen_fd_ is accessed without synchronization across threads #1101

Closed
opened 2026-10-29 21:22:53 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @quantz8a on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4386

Background

UdsAcceptor::acceptLoop() runs on a dedicated std::jthread. It reads listen_fd_ for every accept() call and, when the loop exits, closes the descriptor and sets listen_fd_ = -1.

UdsAcceptor::stop() runs on another thread: it calls wakeAccept(), joins the accept thread, reads listen_fd_, closes it, and resets it to -1.

Concurrent unsynchronized access to the non-atomic int listen_fd_ from those two threads is a data race and undefined behavior.

Scope

  • mooncake-store/src/uds_transport.cpp

Proposed fix

  • #4384 removes the trailing close/write from acceptLoop() so the accept thread only reads listen_fd_, while stop() closes the descriptor after join().
Originally created by @quantz8a on GitHub (Sep 29, 2026). Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4386 ## Background `UdsAcceptor::acceptLoop()` runs on a dedicated `std::jthread`. It reads `listen_fd_` for every `accept()` call and, when the loop exits, closes the descriptor and sets `listen_fd_ = -1`. `UdsAcceptor::stop()` runs on another thread: it calls `wakeAccept()`, joins the accept thread, reads `listen_fd_`, closes it, and resets it to `-1`. Concurrent unsynchronized access to the non-atomic `int listen_fd_` from those two threads is a data race and undefined behavior. ## Scope - `mooncake-store/src/uds_transport.cpp` ## Proposed fix - #4384 removes the trailing close/write from `acceptLoop()` so the accept thread only reads `listen_fd_`, while `stop()` closes the descriptor after `join()`.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 29, 2026):

Thanks for opening this issue, @quantz8a!

Field Value
Issue #4386
GitHub user ID 3152505
Reporter @quantz8a

A maintainer will triage this when possible. To help us respond faster, please include:

  • Mooncake version or commit SHA
  • Environment (OS, CUDA/driver, RDMA stack if relevant)
  • Steps to reproduce and expected vs. actual behavior

Useful links: Documentation · Contributing guide

This message was posted automatically by the issue bot.

<!-- gh-comment-id:5885711054 --> @github-actions[bot] commented on GitHub (Sep 29, 2026): Thanks for opening this issue, @quantz8a! | Field | Value | |-------|-------| | **Issue** | #4386 | | **GitHub user ID** | `3152505` | | **Reporter** | @quantz8a | A maintainer will triage this when possible. To help us respond faster, please include: - Mooncake version or commit SHA - Environment (OS, CUDA/driver, RDMA stack if relevant) - Steps to reproduce and expected vs. actual behavior Useful links: [Documentation](https://kvcache-ai.github.io/Mooncake/) · [Contributing guide](https://github.com/kvcache-ai/Mooncake/blob/main/CONTRIBUTING.md) > This message was posted automatically by the issue bot.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/Mooncake#1101
No description provided.