[GH-ISSUE #4664] dsv41 CUDA tp2: >=42K-token prompts stall at the prompt-reading tail - all workers parked on condvars (lost wakeup); full backtrace inside #2121

Closed
opened 2026-11-04 01:56:51 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @jinsoo on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4664

Summary

Prompts of ~42K+ tokens (chunked prefill, 4096-token chunks) stall at the very end of prompt reading on CUDA 2×RTX 4090 (--tp 2). The stall sits at the final chunk boundary ("reading the prompt: 47,850 of 47,850 tokens" stops updating), lasts minutes or forever, and a full-thread backtrace shows every worker parked on a condition variable — no thread is computing, and the GPU is idle. This looks like a lost-wakeup / missing-notify at the last chunk, not a performance cliff.

Environment

  • Engine: release 0.1.52 (cuda13 package) and a source build of v0.2.7.1 (build_dsv41_cuda.sh, ARCH=89-real, CUDA 12.4) — both reproduce
  • GPUs: 2×RTX 4090, --tp 2 --reserve-mib 3072, --max-context 131072
  • Model: DeepSeek-V4.1-Flash UD-Q8 (MXFP4 experts), pack on local NVMe
  • Host: Threadripper 5995WX, 8-channel DDR4, Ubuntu 24.04
  • Repro: any single-turn prompt ≥ ~42K tokens (mine is 47,850); ≤24K is unaffected (204–259 tok/s)

Behavior timeline (0.1.52, consistent across runs)

  1. Chunks 1–10 read at 200+ tok/s, then throughput drops to ~26 tok/s through the high-30Ks
  2. Progress freezes near the tail (e.g. 43,868/47,850 for 286 s+)
  3. Two outcomes observed: (a) permanent freeze — killed by our watchdog; (b) after ~1314 s the request self-cancels with error, cancel=true
  4. The source build (0.1.53-dev) stalled the same way at 47,850/47,850 for 200–300 s in two runs, one then broke through and completed the whole prompt in 401 s total

Full-thread backtrace at the stall (source build, symbols on)

Captured by SIGINT-ing gdb while the progress line was frozen (120 s + into the stall). 107 threads. Nobody is in a CUDA call, nobody is reading, nobody is spinning:

Thread 127 "strata-dsv41":
  #0  clock_nanosleep () from libc
  #1  nanosleep () from libc
  #2  strata::ds4::Model::Impl::serve_lane() ()

Thread 129 "strata-dsv41":
  #0  futex_wait () from libc
  #1  pthread_cond_wait () from libc
  #2  strata::ds4::Model::Impl::cache_loop(strata::ds4::Model::Impl::SwapBufs&) ()

Thread 10..25 "strata-dsv41"   (all 16 identical):
  #0  futex_wait () from libc
  #1  pthread_cond_wait () from libc
  #2  strata::ds4::EgReader::loop() ()      ← src/dsv41/ds4_engram_io.hpp

All remaining threads are parked in the generic CPU-lane worker pool or the RPC reader (getc). Zero cudaEventSynchronize/cudaMemcpy frames anywhere.

Analysis

EgReader is a clean job queue (submit() sets b.left, readers fetch_sub and the last one notifies done_cv_). With all 16 readers parked in cv_.wait waiting for a new job, the in-flight EgBatch already completed — the readers are not the problem. The stall is in the layer that should issue the tail of the last chunk or observe its completion and wake serve_lane/cache_loop (src/dsv41/ds4_model.cu, eg_issue/eg_finish/cache_loop). It matches the "N-7 of N" tail-stall family reported in #3297 and the chunk-boundary reports in #4363.

Workaround

External watchdog: if the engine's progress line holds the same token count for 120 s (or prompt throughput drops under 50 tok/s for 180 s), restart the engine; warm restart is ~1 min. Also #2065-style VRAM headroom matters: without --reserve-mib 3072, the degradation starts as low as 12–24K-token prompts.

Full raw backtrace and logs available on request.

Originally created by @jinsoo on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4664 ## Summary Prompts of ~42K+ tokens (chunked prefill, 4096-token chunks) stall at the very end of prompt reading on CUDA 2×RTX 4090 (`--tp 2`). The stall sits at the final chunk boundary ("reading the prompt: 47,850 of 47,850 tokens" stops updating), lasts minutes or forever, and a full-thread backtrace shows **every worker parked on a condition variable** — no thread is computing, and the GPU is idle. This looks like a lost-wakeup / missing-notify at the last chunk, not a performance cliff. ## Environment - Engine: release **0.1.52** (cuda13 package) and a **source build of v0.2.7.1** (`build_dsv41_cuda.sh`, ARCH=89-real, CUDA 12.4) — both reproduce - GPUs: 2×RTX 4090, `--tp 2 --reserve-mib 3072`, `--max-context 131072` - Model: DeepSeek-V4.1-Flash UD-Q8 (MXFP4 experts), pack on local NVMe - Host: Threadripper 5995WX, 8-channel DDR4, Ubuntu 24.04 - Repro: any single-turn prompt ≥ ~42K tokens (mine is 47,850); ≤24K is unaffected (204–259 tok/s) ## Behavior timeline (0.1.52, consistent across runs) 1. Chunks 1–10 read at 200+ tok/s, then throughput drops to ~26 tok/s through the high-30Ks 2. Progress freezes near the tail (e.g. 43,868/47,850 for 286 s+) 3. Two outcomes observed: (a) permanent freeze — killed by our watchdog; (b) after ~1314 s the request self-cancels with `error, cancel=true` 4. The source build (0.1.53-dev) stalled the same way at 47,850/47,850 for 200–300 s in two runs, one then broke through and completed the whole prompt in 401 s total ## Full-thread backtrace at the stall (source build, symbols on) Captured by SIGINT-ing gdb while the progress line was frozen (120 s + into the stall). 107 threads. Nobody is in a CUDA call, nobody is reading, nobody is spinning: ``` Thread 127 "strata-dsv41": #0 clock_nanosleep () from libc #1 nanosleep () from libc #2 strata::ds4::Model::Impl::serve_lane() () Thread 129 "strata-dsv41": #0 futex_wait () from libc #1 pthread_cond_wait () from libc #2 strata::ds4::Model::Impl::cache_loop(strata::ds4::Model::Impl::SwapBufs&) () Thread 10..25 "strata-dsv41" (all 16 identical): #0 futex_wait () from libc #1 pthread_cond_wait () from libc #2 strata::ds4::EgReader::loop() () ← src/dsv41/ds4_engram_io.hpp ``` All remaining threads are parked in the generic CPU-lane worker pool or the RPC reader (`getc`). Zero `cudaEventSynchronize`/`cudaMemcpy` frames anywhere. ## Analysis `EgReader` is a clean job queue (`submit()` sets `b.left`, readers `fetch_sub` and the last one notifies `done_cv_`). With all 16 readers parked in `cv_.wait` **waiting for a new job**, the in-flight EgBatch already completed — the readers are not the problem. The stall is in the layer that should issue the tail of the last chunk or observe its completion and wake `serve_lane`/`cache_loop` (src/dsv41/ds4_model.cu, `eg_issue`/`eg_finish`/`cache_loop`). It matches the "N-7 of N" tail-stall family reported in #3297 and the chunk-boundary reports in #4363. ## Workaround External watchdog: if the engine's progress line holds the same token count for 120 s (or prompt throughput drops under 50 tok/s for 180 s), restart the engine; warm restart is ~1 min. Also #2065-style VRAM headroom matters: without `--reserve-mib 3072`, the degradation starts as low as 12–24K-token prompts. Full raw backtrace and logs available on request.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 30, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6513854648 --> @github-actions[bot] commented on GitHub (Oct 30, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@Niko1221 commented on GitHub (Oct 31, 2026):

Thanks for the backtrace. We could not test this: we have no DeepSeek pack here where tensor parallel takes effect (on two cards our packs fall back to a layer split), so we have not seen your stall. We did fix a small race in the CPU worker pool that can make a batch run slower; it goes into the next update. We do not know that it is your stall. When the update is out, please try it on your two 4090s and tell us whether the 47,850-token prompt still stops at the end.

<!-- gh-comment-id:6547920335 --> @Niko1221 commented on GitHub (Oct 31, 2026): Thanks for the backtrace. We could not test this: we have no DeepSeek pack here where tensor parallel takes effect (on two cards our packs fall back to a layer split), so we have not seen your stall. We did fix a small race in the CPU worker pool that can make a batch run slower; it goes into the next update. We do not know that it is your stall. When the update is out, please try it on your two 4090s and tell us whether the 47,850-token prompt still stops at the end.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 4, 2026):

Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection.

To bring it back: fix the title (area prefix) and the missing parts, then comment /reopen. A check runs and reopens it, or tells you what is still missing. See CONTRIBUTING.md.

<!-- gh-comment-id:6622492836 --> @github-actions[bot] commented on GitHub (Nov 4, 2026): Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection. To bring it back: fix the title (area prefix) and the missing parts, then comment `/reopen`. A check runs and reopens it, or tells you what is still missing. See [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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
Niko1221/Strata#2121
No description provided.