Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test: Fix flaky L0_http test_large_string_in_json#8819

Open
Vinya567 wants to merge 3 commits into
mainfrom
vinyak/tri-1378-fix-ci-test-l0_http-base
Open

test: Fix flaky L0_http test_large_string_in_json#8819
Vinya567 wants to merge 3 commits into
mainfrom
vinyak/tri-1378-fix-ci-test-l0_http-base

Conversation

@Vinya567
Copy link
Copy Markdown
Contributor

@Vinya567 Vinya567 commented Jun 5, 2026

What does the PR do?

Fixes a deterministic failure in qa/L0_http/http_input_size_limit_test.py::test_large_string_in_json.

The test built a ~2 GiB JSON body to exercise the server's --http-max-input-size guard, but that body produces a Content-Length header beyond INT32_MAX. After the recent std::atoistd::stoi change in Content-Length parsing (#8794), the server now rejects the request at the header-parse step (with an INT32 range error) before ever reaching the JSON-size check the test asserts on, so the test fails on every nightly.

The fix shrinks the request body to byte-precise boundaries around the JSON-size limit, so the test actually exercises the guard it claims to.

Checklist

  • PR title reflects the change and is of format <type>: <description>
  • Changes are described in the pull request.
  • Related issues are referenced.
  • Populated github labels field
  • Added test plan and verified test passes.
  • Verified that the PR passes existing CI.
  • Verified copyright is correct on all changed files.
  • Added succinct git squash message before merging ref.
  • All template sections are filled out.
  • Optional: Additional screenshots for behavior/output changes with before/after.

Commit Type:

Check the conventional commit type
box here and add the label to the github PR.

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • revert
  • style
  • test

Related PRs:

Where should the reviewer start?

qa/L0_http/http_input_size_limit_test.py — the change is contained to one file. Look at the new _build_json_string_body_of_size helper and the rewritten test_large_string_in_json.

Test plan:

Verified locally in a triton-devel container against main:

  • InferSizeLimitTest.test_large_string_in_json — 10/10 pass
  • Full qa/L0_http/test.sh — passes, no other regressions

The new test asserts both sides of the boundary:

  • Body of exactly DEFAULT_LIMIT_BYTES (64 MiB) → must succeed (200)
  • Body of DEFAULT_LIMIT_BYTES + 1 → must fail with the JSON-size error

Body length is constructed exactly (manual json.dumps + posted with data=) so the boundary is byte-precise and not skewed by JSON wrapper overhead. Pattern mirrors the existing both-sides test_default_limit_raw_binary.

  • CI Pipeline ID: 53746524 (L0_http--base job: green)

Caveats:

test_chunked_infer_over_max_chunks_reject_with_bounded_rss_growth (in qa/L0_http/http_request_many_chunks.py) also occasionally fails in nightly runs with intermittent RSS-growth assertions (4.2 MiB > 1 MiB). That failure is intermittent, unrelated to this fix, and should be tracked separately.

Background

test_large_string_in_json was added to verify the server's --http-max-input-size JSON-body limit. The original test built a body large enough to clearly exceed the default 64 MiB limit, but also large enough that the resulting Content-Length header overflows a signed 32-bit integer (Content-Length: 2147483796 vs INT32_MAX = 2147483647).

Before #8794, Content-Length was parsed with std::atoi, which silently returned an undefined-but-non-throwing value on overflow, so the body still reached the JSON-size check. After #8794 switched to std::stoi, that parse now throws std::out_of_range and the server returns 400 with:

Unable to parse Content-Length, value is out of range [ -2147483648, 2147483647 ], got: 2147483796

which doesn't match the JSON-size error the test expects. The fix keeps the test focused on the JSON-size guard by constructing a body just at and just above the limit (well below INT32 Content-Length).

Related Issues:

Vinya567 added 2 commits June 4, 2026 20:17
Use a payload just over the 64MB default limit instead of ~2GB so the
server returns the expected JSON size error rather than rejecting the
request at INT32 Content-Length parsing.
Per Yingge's review feedback on the initial fix:
- Use byte-precise +1 boundary instead of OFFSET_ELEMENTS (32 bytes).
- Add complementary "exactly at limit succeeds" case so the test guards
  both sides of the boundary, matching the pattern used by
  test_default_limit_raw_binary.

Body is constructed manually with json.dumps and posted with data=
so the total HTTP body length is exact (no wrapper-overhead drift).
@Vinya567 Vinya567 requested a review from yinggeh June 5, 2026 03:22
@Vinya567 Vinya567 self-assigned this Jun 5, 2026
@yinggeh yinggeh requested review from pskiran1 and whoisj June 5, 2026 05:11
Comment thread qa/L0_http/http_input_size_limit_test.py Outdated
Comment thread qa/L0_http/http_input_size_limit_test.py Outdated
@yinggeh
Copy link
Copy Markdown
Contributor

yinggeh commented Jun 5, 2026

If you are using agent generating PR description, make sure tell it to use https://github.com/triton-inference-server/server/blob/main/.github/PULL_REQUEST_TEMPLATE/pull_request_template_internal_contrib.md as the template.

@yinggeh
Copy link
Copy Markdown
Contributor

yinggeh commented Jun 5, 2026

Again, do not put linear tickets in public PRs.

@Vinya567 Vinya567 changed the title test: Fix flaky L0_http test_large_string_in_json (TRI-1378) test: Fix flaky L0_http test_large_string_in_json Jun 5, 2026
- Rename _build_string_body_of_size -> _build_json_string_body_of_size
  (more specific name, JSON is the operative format)
- Drop PR-specific commentary from the test docstring and inline
  comments; keep only documentation that's useful when reading the
  test itself

Per review on #8819.
@Vinya567 Vinya567 requested a review from yinggeh June 5, 2026 06:21
@Vinya567
Copy link
Copy Markdown
Contributor Author

Vinya567 commented Jun 5, 2026

Both addressed:

  • PR description rewritten to use pull_request_template_internal_contrib.md all template sections filled out.
  • Scrubbed all Linear / internal references (description, title, etc.).

Sorry for the slip ,added both rules to my onboarding checklist so they don't happen again. Thanks for the catches!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants