Skip to content

[TransferEngine] Avoid false CQ timeout diagnostics after idle periods - #5281

Merged
alogfans merged 2 commits into
kvcache-ai:mainfrom
zkf-qwj:codex/cq-timeout-diagnostic-false-positive
Nov 6, 2026
Merged

alogfans merged 2 commits into
kvcache-ai:mainfrom
zkf-qwj:codex/cq-timeout-diagnostic-false-positive

Conversation

@zkf-qwj

@zkf-qwj zkf-qwj commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #5205.

This PR fixes false-positive CQ completion timeout diagnostic errors that can occur after an RDMA worker pool has been idle.

When the worker pool is idle, the polling worker may park and last_poll_ts_ns_ stops advancing. If a new transfer is posted after a long idle period, the monitor can observe both:

  • a newly non-zero CQ outstanding count; and
  • a large poll_gap_ms inherited from the preceding idle period.

The previous logic treated the stale poll gap alone as a stalled poller, even when the tracked slices had only been posted for a few milliseconds.

The new logic separates two conditions:

  1. Poller stall: report only when the CQ has remained non-empty for at least 5 seconds and the poll gap is also at least 5 seconds.
  2. Transfer no-progress timeout: report when no completion progress has been observed for at least 30 seconds, even if polling is still active.

The diagnostic now reports:

  • cq_nonzero_age_ms: how long the CQ has continuously contained outstanding work;
  • no_progress_age_ms: how long the processed-slice counter has remained unchanged;
  • poll_gap_ms: how long it has been since the last CQ polling pass.

The timeout decision was extracted into a small stateful helper so it can be tested deterministically without RDMA hardware or real-time sleeps.

Module

  • Transfer Engine (mooncake-transfer-engine)

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

The added hardware-independent unit tests cover:

  • a fresh transfer arriving after a long idle poll gap;
  • periodic small transfers separated by idle periods;
  • a genuinely stalled CQ poller;
  • active polling with no completion progress;
  • continuous completion progress while outstanding work remains non-zero;
  • resetting the timeout windows after the CQ drains;
  • the first transfer before any poll timestamp exists.

Test commands:

git diff --check

@github-actions github-actions Bot added run-ci Transfer Engine size/M 100-1000 changed lines (additions + deletions) labels Nov 5, 2026

@alogfans alogfans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alogfans
alogfans merged commit 42bd7e3 into kvcache-ai:main Nov 6, 2026
35 checks passed
jfeng18 added a commit to jfeng18/Mooncake that referenced this pull request Nov 9, 2026
* upstream/main: (28 commits)
  [Store] Remove unreachable dead code in reserved OpLog paths (kvcache-ai#5043)
  [Store][BUGFIX]: Avoid repeated NoF cleanup for unregistered buffers (kvcache-ai#5301)
  [Store] Fence the local disk tier on the first unrecoverable disk error (kvcache-ai#4490)
  [Store] Add opt-in aligned O_DIRECT bucket writes (kvcache-ai#4820)
  [Store] posix support Read DFS replicas straight into host buffers (kvcache-ai#5201)
  [TENT] Pipeline RDMA slice preparation with worker posting (kvcache-ai#5277)
  [TE] HipTransport: submit copies asynchronously, one stream and event per device (kvcache-ai#4953)
  [Misc] Add staryxchen as a HIP transport code owner (kvcache-ai#5351)
  [Doc] nvlink_intra works over PCIe P2P, not only NVLink (kvcache-ai#5266)
  [Bugfix][TENT] Propagate io_uring staging copy failures (kvcache-ai#5335)
  [Bugfix][TENT] Make UB batch submission all-or-nothing (kvcache-ai#5274)
  Add store rs tone tests (kvcache-ai#5282)
  [EP] Validate XPU Buffer constructor arguments (kvcache-ai#5329)
  [EP] Decouple PG builds and add TCPStore bootstrap (kvcache-ai#5312)
  [Bugfix][PG] Serialize RPC socket operations and drain shutdown (kvcache-ai#5098)
  [EP] Enable the native XPU EP over RDMA (kvcache-ai#5207)
  [Store] Use the AWS default credential chain when S3 static keys are unset (kvcache-ai#5303)
  [Bugfix][Store] Register dummy query RPC handlers in mooncake_client (kvcache-ai#5200)
  [Store] Preserve variadic RPC compatible fields with NDEBUG (kvcache-ai#5269)
  [TransferEngine] Avoid false CQ timeout diagnostics after idle periods (kvcache-ai#5281)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci size/M 100-1000 changed lines (additions + deletions) Transfer Engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CQ completion timeout diagnostic

2 participants