Skip to content

fix(rdma): v2.6.3 review fixes — real-us idle threshold, eviction UAF, mode typo guard - #272

Merged
ketor merged 1 commit into
dingodb:mainfrom
ketor:fix/v2.6.3-evict-review
Aug 6, 2026
Merged

fix(rdma): v2.6.3 review fixes — real-us idle threshold, eviction UAF, mode typo guard#272
ketor merged 1 commit into
dingodb:mainfrom
ketor:fix/v2.6.3-evict-review

Conversation

@ketor

@ketor ketor commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review fixes for v2.6.2 (#269/#270)

  1. Idle threshold was 2 ms, not 2 s. SteadyUs() returned steady_clock::count() raw ticks, which are nanoseconds on Linux. Under normal traffic nearly every pooled connection counts as idle → a full segment could evict recently-active connections. Now duration_cast<microseconds>.
  2. Eviction UAF. The evictor woke a live_eps_ pointer whose Serve thread then exited and destroyed the stack endpoint; a concurrent evictor could Wake a freed endpoint. The evictor now erases the victim from live_eps_ under conn_mu_ before Wake (Serve's own erase becomes a no-op) — exactly one evictor ever touches an endpoint.
  3. Total eviction wait bounded to 5 s (was up to 32 s, exceeding the client's 10 s bootstrap).
  4. last_active_us_ == 0 (inserted, not yet stamped by Serve) is never treated as idle.
  5. DFKV_RAM_WRITE_MODE typo guard: only writeback|writearound accepted; anything else warns and falls back to writeback.

Verified (0064, 64MB segment = 15 conns, t16/b1 rounds)

  • A all-active refusal: 26 fails (expected — no idle victim)
  • B–F: 1–2 fails each (concurrent-eviction boundary)
  • 75 evictions, zero crashes/segfaults

v2.6.2 advisory

v2.6.2 shipped #270 with the 2ms-threshold bug; do not deploy it. This fix is the corrected v2.6.3.

…, mode typo guard

Review of v2.6.2 (dingodb#269/dingodb#270) found:

1. SteadyUs() returned steady_clock::count() raw ticks, which are
   NANOSECONDS on Linux. kEvictIdleMinUs=2,000,000 was therefore 2 ms,
   not 2 s: under normal traffic nearly every pooled connection counts
   as idle, so a full segment could evict recently-active connections
   and trigger reconnection storms. Now duration_cast<microseconds>.

2. Eviction woke a live_eps_ pointer whose owning Serve thread then
   exited and destroyed the stack endpoint — a concurrent evictor could
   Wake a freed endpoint (UAF). The evictor now erases the victim from
   live_eps_ under conn_mu_ before Wake (Serve's own erase becomes a
   no-op), so exactly one evictor ever touches an endpoint.

3. Total eviction wait is bounded to 5 s (was up to 32 s, exceeding the
   client's 10 s bootstrap).

4. last_active_us_ == 0 (inserted, not yet stamped by Serve) is never
   treated as idle.

5. DFKV_RAM_WRITE_MODE accepts only writeback|writearound; anything else
   warns and falls back to writeback (was silent writeback on typos).

Verified on 0064 (64MB segment = 15 conns, t16/b1 rounds): A all-active
refusal 26 fails (expected), B-F 1-2 fails each (eviction boundary),
75 evictions, zero crashes/segfaults.
@ketor
ketor added this pull request to the merge queue Aug 6, 2026
Merged via the queue into dingodb:main with commit c3c7434 Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant