[GH-ISSUE #3981] [Engine] Metal: "parallel": 2 / --batch 2 still exits the engine with code 86 (pdl_supported) on 0.2.4.2 — concurrent requests return HTTP 200 with empty answers (re-test of #2715) #1711

Open
opened 2026-11-04 01:53:24 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @yevgenyt on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3981

Area

Engine

Desktop app, Terminal or source?

Source (./setup.sh on macOS, Metal engine built on the Mac)

What happened

Re-test of #2715 on the 0.2.x line, as asked in the tracker reset. It is not fixed, and there is one more symptom worth knowing: from the client's side, the failed requests look successful.

With "parallel": 2 in the model config, the Metal engine boots, allocates two slot sessions and announces batch windows of 2. The first time two requests are actually decoded together, it prints strata::kernels::pdl_supported has no Metal implementation yet and exits with code 86. The server restarts the engine, and the next concurrent request fails the same way.

What the client sees: both concurrent requests come back HTTP 200, with 0–2 tokens of content and a normal end of stream, and no error field. A caller has no way to tell the answer was lost. With 2 × 46K-token prompts, both prompts are read (at about 2,300–2,400 tok/s), then the engine exits after the first token, so about 20–28 s of prompt processing per request is wasted.

Expected one of:

  1. batching works on Metal;
  2. the engine refuses --batch/"parallel" at boot on Metal (or setup does not write it), so the server falls back to one request at a time; or
  3. the failed requests get an error status, not HTTP 200 with an empty answer.

Without "parallel" (one request at a time), the same machine and pack are completely stable. 2 × 46K and 2 × 65K concurrent requests are served in turn with no restarts, at ~2,450–2,630 tok/s prompt and ~117–137 tok/s decode. So the batch path is the only problem.

Smallest steps or command that reproduce it

  1. ./setup.sh --family qwen --model IQ3_S --yes --no-start (macOS, Apple Silicon).
  2. Add "parallel": 2 to strata-iq3_s.json.
  3. Start: .venv/bin/python serve/server.py --engine strata --config strata-iq3_s.json --port 8010.
  4. Send two /v1/chat/completions requests at the same moment (streaming or not), each with a ~3K-token prompt and max_tokens 200.
  5. Both return 200 with 0–2 tokens; the engine log ends with the pdl_supported line and the server reports exit code 86.

Reproduction status

Every time (3 of 3 concurrent batches, ~3K, 46K and 65K-token prompts).

Strata version

  • Release notes 0.2.4.2, git commit 7dd5cf18e68c639a8773e096c5c79f971ea2a9f5 (2026-10-24).
  • Engine 0.1.48-metal, built by setup.sh.

Graphics card, memory and system

  • Apple M5 Ultra, 256 GB unified memory (Mac Studio).
  • macOS 27.0.1 (26A434).
  • iogpu.wired_limit_mb raised to 245760.
  • Models on an external NVMe (USB4).

Model, size and settings

  • Qwen3.8-Flash-Next GSQ-RCO IQ3_S: setup's config, plus "parallel": 2, "reasoning_effort": "none" and --max-context 131072.
  • Defaults: --spec 2, --mtp, --mmap-experts, --expert-cache 64.
  • Pictures off.
  • The same pack and config without "parallel" work correctly.
  • Also tested: Unsloth UD-Q6_K_XL without "parallel", which is stable. Its batch path was not tried.

Logs

Engine log (--batch 2, first concurrent pair, ~3K-token prompts):

strata generate: --batch: 2 slot sessions on CUDA0 (3.34 GiB each); 226.26 GiB free
strata generate: --batch 2: the slot sessions take 6.68 GiB of VRAM on CUDA0 that the expert cache would otherwise hold
strata generate: session is up (engine 0.1.48-metal)
strata verify: batch windows of up to 2 sequences (layers [0, -1))
...
strata batch: slot 0 takes 3229 tokens (copied in 40.3 ms)
strata serve: prompt 3229 tokens = 3228 reused + 1 read in 0 ms (89214.0 tok/s), 1 generated in 12 ms (85.9 tok/s), drafts accepted 0 of 0, 1 checkpoints
strata serve: expert tiers: GPU 0 hits this request; since the start RAM 0 blobs, files 0 blobs 169.9 MB read (the GGUF in place)
strata metal: strata::kernels::pdl_supported has no Metal implementation yet

The same thing at 46K tokens: strata batch: slot 0 takes 46161 tokens (copied in 136.2 ms), then the same last line.

Server log, 2 × 46K-token run:

[strata] reading the prompt: 46,080 of 46,160 tokens, 19 s so far
[strata] the engine stopped unexpectedly (exit code 86). The engine exited (code 86). Its last log line: strata metal: strata::kernels::pdl_supported has no Metal implementation yet - if that does not explain it, please report it at github.com/Niko12…
[strata] done: 0 tokens in 20 s (no speed) (error, cancel=False)
[strata] done: 2 tokens in 20 s (69.7 tok/s) (error, cancel=False)
[strata] the engine had stopped (exit code 86); starting it again (a minute or two) ...

Client side, the same run (streaming): both requests HTTP 200; one with 0 tokens of content, the other with 2 ([r8), and no error in the stream.

Related: #2715 (same crash, engine 0.1.44.1–0.1.45, closed in the 0.2.0 tracker reset, re-confirmed there on 2026-10-23).

Originally created by @yevgenyt on GitHub (Oct 24, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3981 ## Area Engine ## Desktop app, Terminal or source? Source (`./setup.sh` on macOS, Metal engine built on the Mac) ## What happened Re-test of #2715 on the 0.2.x line, as asked in the tracker reset. It is not fixed, and there is one more symptom worth knowing: from the client's side, **the failed requests look successful**. With `"parallel": 2` in the model config, the Metal engine boots, allocates two slot sessions and announces batch windows of 2. The first time two requests are actually decoded together, it prints `strata::kernels::pdl_supported has no Metal implementation yet` and exits with code 86. The server restarts the engine, and the next concurrent request fails the same way. What the client sees: both concurrent requests come back **HTTP 200**, with 0–2 tokens of content and a normal end of stream, and no error field. A caller has no way to tell the answer was lost. With 2 × 46K-token prompts, both prompts are read (at about 2,300–2,400 tok/s), then the engine exits after the first token, so about 20–28 s of prompt processing per request is wasted. Expected one of: 1. batching works on Metal; 2. the engine refuses `--batch`/`"parallel"` at boot on Metal (or setup does not write it), so the server falls back to one request at a time; or 3. the failed requests get an error status, not HTTP 200 with an empty answer. Without `"parallel"` (one request at a time), the same machine and pack are completely stable. 2 × 46K and 2 × 65K concurrent requests are served in turn with no restarts, at ~2,450–2,630 tok/s prompt and ~117–137 tok/s decode. So the batch path is the only problem. ## Smallest steps or command that reproduce it 1. `./setup.sh --family qwen --model IQ3_S --yes --no-start` (macOS, Apple Silicon). 2. Add `"parallel": 2` to `strata-iq3_s.json`. 3. Start: `.venv/bin/python serve/server.py --engine strata --config strata-iq3_s.json --port 8010`. 4. Send two `/v1/chat/completions` requests at the same moment (streaming or not), each with a ~3K-token prompt and `max_tokens` 200. 5. Both return 200 with 0–2 tokens; the engine log ends with the `pdl_supported` line and the server reports exit code 86. ## Reproduction status Every time (3 of 3 concurrent batches, ~3K, 46K and 65K-token prompts). ## Strata version - Release notes 0.2.4.2, git commit `7dd5cf18e68c639a8773e096c5c79f971ea2a9f5` (2026-10-24). - Engine `0.1.48-metal`, built by `setup.sh`. ## Graphics card, memory and system - Apple **M5 Ultra**, 256 GB unified memory (Mac Studio). - macOS **27.0.1** (26A434). - `iogpu.wired_limit_mb` raised to 245760. - Models on an external NVMe (USB4). ## Model, size and settings - Qwen3.8-Flash-Next GSQ-RCO **IQ3_S**: setup's config, plus `"parallel": 2`, `"reasoning_effort": "none"` and `--max-context 131072`. - Defaults: `--spec 2`, `--mtp`, `--mmap-experts`, `--expert-cache 64`. - Pictures off. - The same pack and config without `"parallel"` work correctly. - Also tested: Unsloth UD-Q6_K_XL without `"parallel"`, which is stable. Its batch path was not tried. ## Logs Engine log (`--batch 2`, first concurrent pair, ~3K-token prompts): ```text strata generate: --batch: 2 slot sessions on CUDA0 (3.34 GiB each); 226.26 GiB free strata generate: --batch 2: the slot sessions take 6.68 GiB of VRAM on CUDA0 that the expert cache would otherwise hold strata generate: session is up (engine 0.1.48-metal) strata verify: batch windows of up to 2 sequences (layers [0, -1)) ... strata batch: slot 0 takes 3229 tokens (copied in 40.3 ms) strata serve: prompt 3229 tokens = 3228 reused + 1 read in 0 ms (89214.0 tok/s), 1 generated in 12 ms (85.9 tok/s), drafts accepted 0 of 0, 1 checkpoints strata serve: expert tiers: GPU 0 hits this request; since the start RAM 0 blobs, files 0 blobs 169.9 MB read (the GGUF in place) strata metal: strata::kernels::pdl_supported has no Metal implementation yet ``` The same thing at 46K tokens: `strata batch: slot 0 takes 46161 tokens (copied in 136.2 ms)`, then the same last line. Server log, 2 × 46K-token run: ```text [strata] reading the prompt: 46,080 of 46,160 tokens, 19 s so far [strata] the engine stopped unexpectedly (exit code 86). The engine exited (code 86). Its last log line: strata metal: strata::kernels::pdl_supported has no Metal implementation yet - if that does not explain it, please report it at github.com/Niko12… [strata] done: 0 tokens in 20 s (no speed) (error, cancel=False) [strata] done: 2 tokens in 20 s (69.7 tok/s) (error, cancel=False) [strata] the engine had stopped (exit code 86); starting it again (a minute or two) ... ``` Client side, the same run (streaming): both requests HTTP 200; one with 0 tokens of content, the other with 2 (`[r8`), and no error in the stream. Related: #2715 (same crash, engine 0.1.44.1–0.1.45, closed in the 0.2.0 tracker reset, re-confirmed there on 2026-10-23).
Author
Owner

@TechFUNS commented on GitHub (Oct 27, 2026):

Reproduced on Apple Mac Studio, M5 Max, 64 GB unified memory, macOS 27.0.1, engine
0.1.50-macos-arm64-metal, Qwen3.8-Flash-Next GSQ-RCO Q2_0 pack, --max-context 262144,
--vision, MTP draft on (--spec 2 --mtp <rt>). Reproduced through both serving paths:
the Terminal/launchd serve (--parallel 2 → engine --batch 2) and the 0.2.6 desktop app
("Concurrent requests" = 2 in Expert settings → same --batch 2).

Controlled A/B on one machine, one config, one stimulus

Same prompt (~19.6 KB with repeated segments, max_tokens: 512) in every request; the only
variable is concurrency:

A. Two simultaneous requests, 5 rounds (10 requests total)

  • 10/10 returned HTTP 503, body: the engine stopped unexpectedly (exit code 86)
  • serve log recorded 9 exit code 86 crashes in ~70 s (engine crash-loop: each restart
    survives until the next concurrent pair)
  • last engine log line every time:
    strata metal: strata::kernels::pdl_supported has no Metal implementation yet
  • matches the earlier reports: the engine boots fine with --batch 2 and dies on the first
    batched decode

B. One request at a time, 10 rounds (identical prompts)

  • 10/10 HTTP 200, ~4.07 s each, engine pid unchanged across all rounds, zero crashes
  • the solo path is completely stable even with the same repeated-segment prompts

Two extra observations

  1. The desktop app's own UI does not reproduce this. Opening two chats side by side and
    sending both does not crash the engine — the app's chat panels serialize requests, so
    there is no true concurrent decode. GUI-only reports of "parallel works on Mac" are
    probably false negatives; the API layer is the reliable trigger.
  2. Serving behavior differs on the death: the app's serve returns a clean 503 JSON error
    for non-streaming requests, while streaming clients get a mid-response truncation
    (our Claude Code consumer sees "Server error mid-response"). In sustained real load
    (--parallel 4, Claude Code agent traffic) our serve log accumulated ~200 exit code 86
    crashes in 24 h.

Would be great to see either the Metal implementation of the batched PDL path, or as a
stopgap an engine-side fallback that queues/degrades to the solo path instead of aborting
and killing in-flight requests.

<!-- gh-comment-id:6444026401 --> @TechFUNS commented on GitHub (Oct 27, 2026): Reproduced on **Apple Mac Studio, M5 Max, 64 GB unified memory, macOS 27.0.1**, engine `0.1.50-macos-arm64-metal`, Qwen3.8-Flash-Next GSQ-RCO **Q2_0** pack, `--max-context 262144`, `--vision`, MTP draft on (`--spec 2 --mtp <rt>`). Reproduced through **both** serving paths: the Terminal/launchd serve (`--parallel 2` → engine `--batch 2`) and the 0.2.6 desktop app ("Concurrent requests" = 2 in Expert settings → same `--batch 2`). ## Controlled A/B on one machine, one config, one stimulus Same prompt (~19.6 KB with repeated segments, `max_tokens: 512`) in every request; the only variable is concurrency: **A. Two simultaneous requests, 5 rounds (10 requests total)** - 10/10 returned `HTTP 503`, body: `the engine stopped unexpectedly (exit code 86)` - serve log recorded **9 `exit code 86` crashes in ~70 s** (engine crash-loop: each restart survives until the next concurrent pair) - last engine log line every time: `strata metal: strata::kernels::pdl_supported has no Metal implementation yet` - matches the earlier reports: the engine boots fine with `--batch 2` and dies on the first batched decode **B. One request at a time, 10 rounds (identical prompts)** - 10/10 `HTTP 200`, ~4.07 s each, engine pid unchanged across all rounds, **zero crashes** - the solo path is completely stable even with the same repeated-segment prompts ## Two extra observations 1. **The desktop app's own UI does not reproduce this.** Opening two chats side by side and sending both does *not* crash the engine — the app's chat panels serialize requests, so there is no true concurrent decode. GUI-only reports of "parallel works on Mac" are probably false negatives; the API layer is the reliable trigger. 2. **Serving behavior differs on the death**: the app's serve returns a clean 503 JSON error for non-streaming requests, while streaming clients get a mid-response truncation (our Claude Code consumer sees "Server error mid-response"). In sustained real load (`--parallel 4`, Claude Code agent traffic) our serve log accumulated ~200 `exit code 86` crashes in 24 h. Would be great to see either the Metal implementation of the batched PDL path, or as a stopgap an engine-side fallback that queues/degrades to the solo path instead of aborting and killing in-flight requests.
Author
Owner

@TechFUNS commented on GitHub (Oct 28, 2026):

Follow-up A/B on the same machine (Strata 0.2.7.1, engine 0.1.52-macos-arm64-metal,
Qwen3.8-Flash-Next Q2_0 GGUF, Apple M5 Max 64 GB, macOS 27)

Since our previous comment we tested two mitigation hypotheses. Both failed —
the crash is independent of the speculation flags:

Config Test (2 concurrent /v1/chat/completions x 5 rounds) Result
--batch 2 + --suffix-draft 0 (PDL disabled) 10/10 HTTP 503 engine abort, exit code 86 x9
--batch 2 + drafting layer off (no --mtp) 10/10 HTTP 503 engine abort, exit code 86 x10
parallel=1 (no --batch) 10/10 HTTP 200 (requests queue) zero restarts, stable (PDL + MTP both on)

Every crash log ends with the same line:

strata metal: strata::kernels::pdl_supported has no Metal implementation yet

Root-cause observation from source: in metal/src/engine/stubs.cpp,
pdl_supported() calls strata::metal_engine::missing(...), which aborts the
engine
instead of returning false. It appears to be a support probe that
runs whenever two sequences decode together in batch mode — gated neither by
--suffix-draft nor by the draft-layer settings, which is why both mitigations
failed.

Suggested fix: make this stub return false; on Metal (feature-gate PDL)
instead of aborting. That alone should restore --batch N parallel serving on
Mac (without PDL), which is currently unusable there.

Repro: 5 rounds x 2 concurrent POSTs to /v1/chat/completions with a
repetition-heavy prompt (the same sentence repeated ~60 times),
max_tokens=128, temperature=0. With --batch 2: 10/10 503 + exit code 86;
with parallel=1: 10/10 200.

<!-- gh-comment-id:6473904256 --> @TechFUNS commented on GitHub (Oct 28, 2026): **Follow-up A/B on the same machine (Strata 0.2.7.1, engine 0.1.52-macos-arm64-metal, Qwen3.8-Flash-Next Q2_0 GGUF, Apple M5 Max 64 GB, macOS 27)** Since our previous comment we tested two mitigation hypotheses. Both failed — the crash is independent of the speculation flags: | Config | Test (2 concurrent /v1/chat/completions x 5 rounds) | Result | |---|---|---| | `--batch 2` + `--suffix-draft 0` (PDL disabled) | 10/10 HTTP 503 | engine abort, `exit code 86` x9 | | `--batch 2` + drafting layer off (no `--mtp`) | 10/10 HTTP 503 | engine abort, `exit code 86` x10 | | `parallel=1` (no `--batch`) | 10/10 HTTP 200 (requests queue) | zero restarts, stable (PDL + MTP both on) | Every crash log ends with the same line: strata metal: strata::kernels::pdl_supported has no Metal implementation yet Root-cause observation from source: in `metal/src/engine/stubs.cpp`, `pdl_supported()` calls `strata::metal_engine::missing(...)`, which **aborts the engine** instead of returning `false`. It appears to be a support probe that runs whenever two sequences decode together in batch mode — gated neither by `--suffix-draft` nor by the draft-layer settings, which is why both mitigations failed. Suggested fix: make this stub `return false;` on Metal (feature-gate PDL) instead of aborting. That alone should restore `--batch N` parallel serving on Mac (without PDL), which is currently unusable there. Repro: 5 rounds x 2 concurrent POSTs to `/v1/chat/completions` with a repetition-heavy prompt (the same sentence repeated ~60 times), `max_tokens=128`, `temperature=0`. With `--batch 2`: 10/10 503 + `exit code 86`; with `parallel=1`: 10/10 200.
Author
Owner

@northpixelworks commented on GitHub (Oct 30, 2026):

Another data point: M1 Pro 16 GB, streaming mode, different abort site (Strata 0.2.7, engine 0.1.52-macos-arm64-metal, Q2_0, macOS 27.2)

Same symptom family on a small Mac where Q2_0 is streamed from SSD (expert arena only 0.8 GB). Two concurrent /v1/chat/completions (≈ 4.7k-token prompts, max_tokens 10096, reasoning budget 4096) via strata launch --preset … --parallel 2 --context 32k and again with --context 16k:

  • both requests → HTTP 503, engine restarts; reproducible 2/2.
  • at 32k the log first warns only 0 MiB of VRAM free at the start of this request; at 16k it reports 3674 MiB of VRAM free with everything loaded, so it does not look like plain memory pressure.
  • abort site is not pdl_supported here, but the KV save path after the first prompt is read:
    strata metal runtime: a copy touches a device allocation of 559.2 MB that was given back (STRATA_METAL_KEEP_HOST_WEIGHTS=1 keeps it)
    strata::gpu::(anon)::encode_copy … → gpu::memcpy_async → core::conversation_detail::copy_nonblocking → core::conversation_kv_save
    
    preceded by strata metal stream: 3.69 GB of the host code's device weight copies given back (unused by the Metal window).
  • Sequential (default parallel) on the same machine is stable: two of these requests take 26.9 + 29.2 min (≈ 4.3 tok/s).

So on streamed Metal setups the batch path seems to touch weight copies that the stream window already released. I haven't tried STRATA_METAL_KEEP_HOST_WEIGHTS=1 (on 16 GB it would likely not fit). Happy to rerun with a debug flag if useful.

<!-- gh-comment-id:6524890352 --> @northpixelworks commented on GitHub (Oct 30, 2026): **Another data point: M1 Pro 16 GB, streaming mode, different abort site (Strata 0.2.7, engine 0.1.52-macos-arm64-metal, Q2_0, macOS 27.2)** Same symptom family on a small Mac where Q2_0 is streamed from SSD (expert arena only 0.8 GB). Two concurrent `/v1/chat/completions` (≈ 4.7k-token prompts, `max_tokens` 10096, reasoning budget 4096) via `strata launch --preset … --parallel 2 --context 32k` and again with `--context 16k`: - both requests → **HTTP 503**, engine restarts; reproducible 2/2. - at 32k the log first warns `only 0 MiB of VRAM free at the start of this request`; at 16k it reports `3674 MiB of VRAM free with everything loaded`, so it does not look like plain memory pressure. - abort site is not `pdl_supported` here, but the KV save path after the first prompt is read: ``` strata metal runtime: a copy touches a device allocation of 559.2 MB that was given back (STRATA_METAL_KEEP_HOST_WEIGHTS=1 keeps it) strata::gpu::(anon)::encode_copy … → gpu::memcpy_async → core::conversation_detail::copy_nonblocking → core::conversation_kv_save ``` preceded by `strata metal stream: 3.69 GB of the host code's device weight copies given back (unused by the Metal window)`. - Sequential (default parallel) on the same machine is stable: two of these requests take 26.9 + 29.2 min (≈ 4.3 tok/s). So on streamed Metal setups the batch path seems to touch weight copies that the stream window already released. I haven't tried `STRATA_METAL_KEEP_HOST_WEIGHTS=1` (on 16 GB it would likely not fit). Happy to rerun with a debug flag if useful.
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#1711
No description provided.