[GH-ISSUE #4392] [Other] A chunked request body with exactly 64 trailers is refused 400: off-by-one in the trailer loop #1948

Closed
opened 2026-11-04 01:55:32 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @TheHubUser4860938 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4392

Problem: serve/server.py (_read_chunked, v0.2.7 lines 6563-6569): after the final chunk, for _ in range(64): reads "the trailers, including the final blank line" — the terminating blank line must be one of the 64 reads, so a well-formed body with 64 trailer FIELDS (64 lines + blank) exits the loop and raises BadBody(400, "too many chunked request trailers"). The real allowance is 63 fields. RFC 9112 section 7.1 recommends servers accept at least 256 trailer lines.

Environment:
Strata Version: 0.2.7 (source checkout at tag v0.2.7, commit 5e8a4cca; the file discussed is byte-identical to the tag)
OS: Linux x86-64
Runtime: Python 3.14
Reported from the Strata-Mnemosyne fork's merged tree; the offending code is upstream's own.

Reproduce (measured against MockEngine on an ephemeral port): POST /v1/chat/completions with Transfer-Encoding: chunked, body 2\r\nhi\r\n + 64 x a: b\r\n + \r\n → HTTP 400 ... too many chunked request trailers; 63 fields pass.
Expected: accept it (or at least match the documented intent: 64 fields fit inside 64 lines when the blank line is the 65th read).
Actual: 400 + connection close for a valid request; practical blast radius small (proxies/relays that send many trailers).

Reproduction status: measured locally (MockEngine, not the full model boot).

Originally created by @TheHubUser4860938 on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4392 Problem: serve/server.py (_read_chunked, v0.2.7 lines 6563-6569): after the final chunk, `for _ in range(64):` reads "the trailers, including the final blank line" — the terminating blank line must be one of the 64 reads, so a well-formed body with 64 trailer FIELDS (64 lines + blank) exits the loop and raises `BadBody(400, "too many chunked request trailers")`. The real allowance is 63 fields. RFC 9112 section 7.1 recommends servers accept at least 256 trailer lines. Environment: **Strata Version:** 0.2.7 (source checkout at tag v0.2.7, commit 5e8a4cca; the file discussed is byte-identical to the tag) **OS:** Linux x86-64 **Runtime:** Python 3.14 Reported from the Strata-Mnemosyne fork's merged tree; the offending code is upstream's own. Reproduce (measured against MockEngine on an ephemeral port): `POST /v1/chat/completions` with `Transfer-Encoding: chunked`, body `2\r\nhi\r\n` + 64 x `a: b\r\n` + `\r\n` → `HTTP 400 ... too many chunked request trailers`; 63 fields pass. Expected: accept it (or at least match the documented intent: 64 fields fit inside 64 lines when the blank line is the 65th read). Actual: 400 + connection close for a valid request; practical blast radius small (proxies/relays that send many trailers). Reproduction status: measured locally (MockEngine, not the full model boot).
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660383008 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [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#1948
No description provided.