[GH-ISSUE #183] Client disconnect/cancel during long prompt kills the engine (exit code 1) instead of cancelling only the request #95

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

Originally created by @jinkang06 on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/183

## Description

On Linux with Strata v0.1.27, cancelling/disconnecting an in-flight
request during long-prompt prefill causes the engine process itself
to exit with code 1.

The frontend then reloads the entire model and loses the conversation
cache.

I am seeing this with OpenClaw through the OpenAI-compatible API.

A client disconnect/cancel should cancel the current request but keep
the engine alive for the next request.

## Environment

- Strata: v0.1.27
- OS: Ubuntu 22.04.5 LTS
- GPU: NVIDIA RTX A4500 20 GB (SM86)
- Driver: 580.173.02
- CUDA build: CUDA 13.0
- CPU: Intel Xeon w3-2435 (AVX-512)
- RAM: 377 GB
- Model: Qwen3.8-Flash-Next IQ3_S
- Context: 262144
- KV: int8, KV streaming enabled
- KV resident: 32768
- Client: OpenClaw, OpenAI-compatible API

## What happened

During prompt processing:

```text
[strata] reading the prompt: 121,526 of 204,456 tokens, 72 s so far
[strata] done: 0 tokens in 72 s (0.0 tok/s) (disconnect, cancel=True)
[strata] the engine reported an error: cancelled
[strata] done: 0 tokens in 4 s (0.0 tok/s) (error, cancel=False)
[strata] the engine had stopped (exit code 1); starting it again ...

The engine log says:

strata serve: prompt 204456 tokens = 0 reused + 204456 read in 71966 ms
(2841.0 tok/s), 0 generated in 0 ms, drafts accepted 0 of 0,
6 checkpoints (cancelled)

strata serve: KV streaming: 100.00% of 0 block reads hit VRAM,
0.0 MiB read from RAM

strata serve: cancelled

There is no CUDA OOM, watchdog timeout, or no-progress error.

After this, the engine is completely restarted:

[strata] starting the engine: reading the model's weights ...
[strata] loading the experts into RAM ...
[strata] experts loaded: 46.84 GiB ...
[strata] filling the GPU's expert cache ...

The next request therefore loses the previous conversation state and
starts prompt processing from token zero again:

[strata] reading the prompt: 8,192 of 218,200 tokens, 5 s so far

Expected behavior

A disconnect / request cancellation should:

  1. stop the current request;
  2. cleanly discard or roll back any incomplete request state;
  3. keep the engine process alive;
  4. allow the next request to start without reloading the model.

Ideally, valid conversation checkpoints from before the cancelled
request should also remain usable.

The Strata documentation says that closing the connection or pressing
Stop stops the current model work so that the next request can start
immediately.

Additional VRAM information

After the restart Strata reports:

strata generate: expert cache 6663 slots, 12.65 GiB of VRAM
...
strata serve: 239 MiB of VRAM free with everything loaded - LOW:
requests may stall; add --vram-reserve-mib 973

I will also test with the recommended larger VRAM reserve, but the
failure above appears to follow the explicit cancellation path rather
than an OOM path.

Question

Is cancelled currently expected to terminate the engine process on
Linux, or should this be handled as a recoverable per-request outcome?

I can test a patch or provide more logs if useful.

Originally created by @jinkang06 on GitHub (Sep 30, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/183 ```markdown ## Description On Linux with Strata v0.1.27, cancelling/disconnecting an in-flight request during long-prompt prefill causes the engine process itself to exit with code 1. The frontend then reloads the entire model and loses the conversation cache. I am seeing this with OpenClaw through the OpenAI-compatible API. A client disconnect/cancel should cancel the current request but keep the engine alive for the next request. ## Environment - Strata: v0.1.27 - OS: Ubuntu 22.04.5 LTS - GPU: NVIDIA RTX A4500 20 GB (SM86) - Driver: 580.173.02 - CUDA build: CUDA 13.0 - CPU: Intel Xeon w3-2435 (AVX-512) - RAM: 377 GB - Model: Qwen3.8-Flash-Next IQ3_S - Context: 262144 - KV: int8, KV streaming enabled - KV resident: 32768 - Client: OpenClaw, OpenAI-compatible API ## What happened During prompt processing: ```text [strata] reading the prompt: 121,526 of 204,456 tokens, 72 s so far [strata] done: 0 tokens in 72 s (0.0 tok/s) (disconnect, cancel=True) [strata] the engine reported an error: cancelled [strata] done: 0 tokens in 4 s (0.0 tok/s) (error, cancel=False) [strata] the engine had stopped (exit code 1); starting it again ... ``` The engine log says: ```text strata serve: prompt 204456 tokens = 0 reused + 204456 read in 71966 ms (2841.0 tok/s), 0 generated in 0 ms, drafts accepted 0 of 0, 6 checkpoints (cancelled) strata serve: KV streaming: 100.00% of 0 block reads hit VRAM, 0.0 MiB read from RAM strata serve: cancelled ``` There is no CUDA OOM, watchdog timeout, or no-progress error. After this, the engine is completely restarted: ```text [strata] starting the engine: reading the model's weights ... [strata] loading the experts into RAM ... [strata] experts loaded: 46.84 GiB ... [strata] filling the GPU's expert cache ... ``` The next request therefore loses the previous conversation state and starts prompt processing from token zero again: ```text [strata] reading the prompt: 8,192 of 218,200 tokens, 5 s so far ``` ## Expected behavior A disconnect / request cancellation should: 1. stop the current request; 2. cleanly discard or roll back any incomplete request state; 3. keep the engine process alive; 4. allow the next request to start without reloading the model. Ideally, valid conversation checkpoints from before the cancelled request should also remain usable. The Strata documentation says that closing the connection or pressing Stop stops the current model work so that the next request can start immediately. ## Additional VRAM information After the restart Strata reports: ```text strata generate: expert cache 6663 slots, 12.65 GiB of VRAM ... strata serve: 239 MiB of VRAM free with everything loaded - LOW: requests may stall; add --vram-reserve-mib 973 ``` I will also test with the recommended larger VRAM reserve, but the failure above appears to follow the explicit cancellation path rather than an OOM path. ## Question Is `cancelled` currently expected to terminate the engine process on Linux, or should this be handled as a recoverable per-request outcome? I can test a patch or provide more logs if useful. ```
Author
Owner

@demon851113 commented on GitHub (Sep 30, 2026):

Reproduced this on an RTX 5070 Ti with the same KV setup (int8, streamed, --kv-resident 32768), both through the HTTP server and with a private engine. Root cause: the err string survives the cancelled request as "cancelled", and the next request's batched prompt path (sp.on_chunk) reads a non-empty err as a failure. Fix and validation are in #194.

<!-- gh-comment-id:5904311045 --> @demon851113 commented on GitHub (Sep 30, 2026): Reproduced this on an RTX 5070 Ti with the same KV setup (int8, streamed, `--kv-resident 32768`), both through the HTTP server and with a private engine. Root cause: the `err` string survives the cancelled request as `"cancelled"`, and the next request's batched prompt path (`sp.on_chunk`) reads a non-empty `err` as a failure. Fix and validation are in #194.
Author
Owner

@Niko1221 commented on GitHub (Sep 30, 2026):

Confirmed: a cancelled request left a stale 'cancelled' error string behind, and the next long prompt then failed and the engine exited. Fixed in 0.1.28 (in testing now) with #205's change; thanks also to @demon851113 for the root cause and validation in #194. Your '239 MiB free - LOW' line is a separate 0.1.27 problem (#199). Until then, add "--vram-reserve-mib", "1100" to the args of your strata-<model>.json (or pass --vram-reserve-mib 1100 to the engine).

<!-- gh-comment-id:5907794858 --> @Niko1221 commented on GitHub (Sep 30, 2026): Confirmed: a cancelled request left a stale 'cancelled' error string behind, and the next long prompt then failed and the engine exited. Fixed in 0.1.28 (in testing now) with #205's change; thanks also to @demon851113 for the root cause and validation in #194. Your '239 MiB free - LOW' line is a separate 0.1.27 problem (#199). Until then, add `"--vram-reserve-mib", "1100"` to the `args` of your `strata-<model>.json` (or pass `--vram-reserve-mib 1100` to the engine).
Author
Owner

@Niko1221 commented on GitHub (Sep 30, 2026):

Fixed in 0.1.28 (#205): the error string is cleared for every request and at the start of every prompt read. Our repro (a 35K prompt cancelled after 5 s, then the same prompt, then a short one) failed on 0.1.27 and passes on 0.1.28.

<!-- gh-comment-id:5908629602 --> @Niko1221 commented on GitHub (Sep 30, 2026): Fixed in [0.1.28](https://github.com/Niko1221/Strata/releases/tag/v0.1.28) (#205): the error string is cleared for every request and at the start of every prompt read. Our repro (a 35K prompt cancelled after 5 s, then the same prompt, then a short one) failed on 0.1.27 and passes on 0.1.28.
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#95
No description provided.