You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens-G (via GitHub)" <gi...@apache.org> on 2026/05/21 22:14:49 UTC
[PR] THRIFT-6024: Use DEFAULT_MAX_FRAME_SIZE as default in Python THeaderTransport and TZlibTransport [thrift]
Jens-G opened a new pull request, #3518:
URL: https://github.com/apache/thrift/pull/3518
## Summary
- `HARD_MAX_FRAME_SIZE` (`0x3FFFFFFF`, ~1 GB) is a protocol-level structural constraint — the THeader frame length field is 30 bits wide. It is not a policy default.
- All other Thrift bindings use `DEFAULT_MAX_FRAME_SIZE` (`16384000`, ~16 MB) as the default, matching the value in `TConfiguration` (C++, Java, Go, etc.).
- Python's `THeaderTransport` and `TZlibTransport` were constructed with `HARD_MAX_FRAME_SIZE` as their default, leaving applications unprotected against oversized or malformed frames unless the caller explicitly called `set_max_frame_size()`.
**Changes:**
- Add `DEFAULT_MAX_FRAME_SIZE = 16384000` constant to `THeaderTransport.py` alongside `HARD_MAX_FRAME_SIZE`
- Use `DEFAULT_MAX_FRAME_SIZE` as the constructor default for `_max_frame_size` and `_max_decompressed_size` in `THeaderTransport`
- Use `DEFAULT_MAX_FRAME_SIZE` as the default for `max_decompressed_size` in `TZlibTransport` and `TZlibTransportFactory`
- `HARD_MAX_FRAME_SIZE` is retained as the validation ceiling in `set_max_frame_size()` / `set_max_decompressed_size()`
- Fix a pre-existing flake8 `E303` (too many blank lines) in `thrift_TZlibTransport.py`
## Test plan
- [ ] Existing `THeaderTransport` and `TZlibTransport` tests pass
- [ ] `flake8` clean on modified files
- [ ] Verify default behaviour: a `THeaderTransport` constructed without arguments now rejects frames larger than 16384000 bytes without needing an explicit `set_max_frame_size()` call
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-6024: Use DEFAULT_MAX_FRAME_SIZE as default in Python THeaderTransport and TZlibTransport [thrift]
Posted by "Jens-G (via GitHub)" <gi...@apache.org>.
Jens-G merged PR #3518:
URL: https://github.com/apache/thrift/pull/3518
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org