Skip to content

fix: Set memory decompression limit#8570

Merged
mattwittwer merged 13 commits into
mainfrom
mwittwer/set_memory_decompression_limit
Dec 18, 2025
Merged

fix: Set memory decompression limit#8570
mattwittwer merged 13 commits into
mainfrom
mwittwer/set_memory_decompression_limit

Conversation

@mattwittwer

@mattwittwer mattwittwer commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

What does the PR do?

This PR adds additional size validation to compressed inputs.

Checklist

  • PR title reflects the change and is of format <commit_type>: <Title>
  • 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?

The main changes are in: src/data_compressor.h please review the logic to calculate the size of the decompressed buffer and then review the testing changes.

Test plan:

Yes specific tests for this decompression function were added here: src/test/data_compressor_test.cc
And additional end to end tests were added here: qa/L0_http/http_input_size_limit_test.py

  • CI Pipeline ID:

40402527

Caveats:

Background

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

@mattwittwer mattwittwer self-assigned this Dec 10, 2025
@mattwittwer mattwittwer added the bug Something isn't working label Dec 10, 2025
@mattwittwer mattwittwer changed the title draft: Set memory decompression limit fix: Set memory decompression limit Dec 11, 2025
Comment thread src/data_compressor.h Outdated
Comment thread src/data_compressor.h
Comment thread src/data_compressor.h
Comment thread qa/L0_http/test.sh
@yinggeh

yinggeh commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

Please also update command_line_parser.cc.

@mattwittwer

Copy link
Copy Markdown
Contributor Author

Please also update command_line_parser.cc.

Updated the description of http-max-input-size in command_line_parser.cc.

whoisj
whoisj previously approved these changes Dec 17, 2025

@whoisj whoisj 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.

LGTM :shipit:

Comment thread src/data_compressor.h
whoisj
whoisj previously approved these changes Dec 17, 2025
@mattwittwer

Copy link
Copy Markdown
Contributor Author

Encountered error with base case where decompression size == decompression limit failed to allocate:

[ RUN      ] DataCompressorTest.DecompressionSizeLimitGzip
/opt/tritonserver/server/src/test/data_compressor_test.cc:698: Failure
Value of: (err == nullptr)
  Actual: false
Expected: true
64 MB data should decompress at exact 64 MB limit: Decompressed data size exceeds the maximum allowed value of 67108864 bytes. Use --http-max-input-size to increase the limit.
[  FAILED  ] DataCompressorTest.DecompressionSizeLimitGzip (1476 ms)
[ RUN      ] DataCompressorTest.DecompressionSizeLimitDeflate
/opt/tritonserver/server/src/test/data_compressor_test.cc:776: Failure
Value of: (err == nullptr)
  Actual: false
Expected: true
64 MB data should decompress at exact 64 MB limit: Decompressed data size exceeds the maximum allowed value of 67108864 bytes. Use --http-max-input-size to increase the limit.
[  FAILED  ] DataCompressorTest.DecompressionSizeLimitDeflate (1510 ms)
[----------] 12 tests from DataCompressorTest (5481 ms total)

[----------] Global test environment tear-down
[==========] 12 tests from 1 test suite ran. (5481 ms total)
[  PASSED  ] 10 tests.
[  FAILED  ] 2 tests, listed below:

Resolved with an additional check:
If there is nothing more to decompress. Break the inflate() loop. No need to generate a new buffer. This is especially important when there is no more room to allocate additional buffer.
https://github.com/triton-inference-server/server/blob/mwittwer/set_memory_decompression_limit/src/data_compressor.h#L314-L318

@yinggeh yinggeh 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.

LGTM

@mattwittwer
mattwittwer merged commit cd0e3a6 into main Dec 18, 2025
3 checks passed
@mattwittwer
mattwittwer deleted the mwittwer/set_memory_decompression_limit branch December 18, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

3 participants