Skip to content

test(frontend): stop the oversized-body test racing the server - #13704

Open
ayaangazali wants to merge 1 commit into
ai-dynamo:mainfrom
ayaangazali:fix/oversized-body-test-flake
Open

test(frontend): stop the oversized-body test racing the server#13704
ayaangazali wants to merge 1 commit into
ai-dynamo:mainfrom
ayaangazali:fix/oversized-body-test-flake

Conversation

@ayaangazali

@ayaangazali ayaangazali commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

test_oversized_body_returns_json_413 posts a 2 MiB body against a 1 MiB cap. The server answers 413 and closes as soon as it has read one byte past the cap, so the client is still writing into a socket whose peer has gone away. The status arrives, and then reading the body fails:

body must be JSON: reqwest::Error { kind: Decode, source: hyper::Error(Body, "connection error") }

This is ordinary HTTP rather than a server bug. A server may answer and close before a request body is fully sent. The test was asserting a guarantee HTTP does not give it once the overshoot is large enough to outlive the socket buffers.

The fix is to stop racing: overshoot the cap by 4 KiB instead of 1 MiB. The body is still oversized, every assertion is unchanged (413, application/json, the exact message naming DYN_HTTP_BODY_LIMIT_MB), and the client finishes writing before the server replies, so the response body is readable every time.

I first reported this as a flake on #13624 and have been disclosing it in the validation notes of #13685, #13696, #13698 and #13699. It is worth fixing rather than continuing to annotate, because it makes cargo test -p dynamo-llm red by default for a whole class of contributors, and a suite that is normally red stops being read.

This is not a CI fix, and I do not want it read as one. rust-tests is green on Linux and was green throughout; the race depends on socket buffering and does not surface there. The benefit is local development on macOS. The comment in the test says this explicitly, so a green CI run is not mistaken for evidence the race is gone, and so nobody enlarges the overshoot again.

Validation

Measured rather than asserted, serialized so nothing else could interfere, at a 1 MiB cap on macOS arm64:

body result
2 MiB (before) 3 pass / 13 fail of 16
cap + 4 KiB (after) 24 pass / 0 fail (16 + an earlier 8)
cap + 4 KiB, re-run on the final commit 12 pass / 0 fail

Whole-crate effect, which is the reason this matters:

before: test result: FAILED. 2042 passed; 1 failed;  (on most runs)
after:  test result: ok.     2041 passed; 0 failed;  (three consecutive runs)

cargo clippy and cargo fmt --all -- --check clean.

Not addressed here, deliberately: making the server deliver its 413 body reliably under a large overshoot would mean draining a request body that was just rejected for being too large. That is a cost decision for whoever owns that path, not something to smuggle into a test fix.


Open in Devin Review

Summary by CodeRabbit

  • Tests
    • Updated oversized-request coverage to exceed the configured payload limit by a smaller margin.
    • Documented connection-reset behavior that can occur when requests significantly exceed the limit.

`test_oversized_body_returns_json_413` posts a 2 MiB body against a 1 MiB cap.
The server answers 413 and closes as soon as it has read one byte past the cap,
so the client is still writing into a socket whose peer has gone away. The
status arrives and then reading the body fails:

    body must be JSON: reqwest::Error { kind: Decode,
      source: hyper::Error(Body, "connection error") }

That is ordinary HTTP, not a server bug: a server may answer and close before
a request body is fully sent. The test was asserting a guarantee HTTP does not
give it for a large overshoot.

Overshoot the cap by 4 KiB instead of 1 MiB. The body is still oversized, the
assertions are unchanged, and the client finishes writing before the server
replies, so the response is readable every time.

Measured on macOS at a 1 MiB cap: the 2 MiB body failed 13 of 16 runs, the
4 KiB overshoot passed 24 of 24. The whole crate suite now passes cleanly
where it previously failed on most runs.

Linux CI does not surface this, so `rust-tests` was green throughout. The
comment says so, to stop a green CI run being read as evidence the race is
gone, and to stop the overshoot being enlarged again.

Signed-off-by: ayaangazali <ayaangazali.work@gmail.com>
@ayaangazali
ayaangazali requested a review from a team as a code owner August 24, 2026 02:02
Copilot AI lite review requested due to automatic review settings August 24, 2026 02:02
@copy-pr-bot

copy-pr-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ayaangazali
ayaangazali deployed to external_collaborator August 24, 2026 02:02 — with GitHub Actions Active
@ayaangazali
ayaangazali deployed to external_collaborator August 24, 2026 02:02 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the test label Aug 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi ayaangazali! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added external-contribution Pull request is from an external contributor frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` labels Aug 24, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ebfc7a5e-0211-46ae-a0d4-68b7b0017f93

📥 Commits

Reviewing files that changed from the base of the PR and between 004cd02 and 155e787.

📒 Files selected for processing (1)
  • lib/llm/src/http/service/service_v2.rs

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

Changes

Body limit test

Layer / File(s) Summary
Oversized request test behavior
lib/llm/src/http/service/service_v2.rs
The test defines the 1 MiB body limit locally and sends a payload that exceeds it by 4 KiB. The test documents the connection-reset race avoided by the smaller overshoot.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 155e7

The change reduces the oversized-body test's request overshoot to avoid a client/server write-close race while preserving all response assertions. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the change and validation, but it omits the required Related Issues section and reviewer starting point. Add the required Related Issues choice and a Where should the reviewer start section naming lib/llm/src/http/service/service_v2.rs.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the oversized-body test race and the change made to stop it.

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contribution Pull request is from an external contributor frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` size/S test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants