Repository navigation
THRIFT-6561: Report preset-dictionary Ruby Header ZLIB payloads as TransportException - #4194
Merged
Merged
Conversation
…ansportException Client: rb Generated-By: amp/0.0.1794916837-g564d50 (model: anthropic/claude-opus-5-5; operator: kpumuk@apache.org)
slachiewicz
approved these changes
Nov 17, 2026
slachiewicz
left a comment
Member
There was a problem hiding this comment.
LGTM. The new spec fails on master with Zlib::NeedDict: need dictionary and passes with the change; the full header_transport_spec.rb is green (73 examples).
NeedDict was the only gap: 20k random mutations of a valid deflate stream produced only DataError, BufError and NeedDict, all of which now surface as TransportException with the original Zlib error kept as #cause. Leaving StreamError/MemError/VersionError unmapped looks right to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HeaderTransportconvertsZlib::DataErrorandZlib::BufErrorfrom the ZLIB transform into aThrift::TransportException(THRIFT-6141), but notZlib::NeedDict. A compressed frame payload whose ZLIB header requests a preset dictionary therefore raised a rawZlib::NeedDict. Servers that handle transport errors per connection treated it as unexpected; aThreadedServerclient thread, for example, ended with an exception report. This change reports such payloads like other invalid ZLIB payloads:TransportExceptiontypeUNKNOWN, "Invalid ZLIB payload".The remaining
Zlib::Errorsubclasses (StreamError,MemError,VersionError, and others) indicate API misuse, allocation failure or the gzip reader rather than malformed input, so they still propagate unchanged.The new spec adds a preset-dictionary payload to the existing invalid ZLIB payload examples, read through
HeaderTransport#read. It fails on master and passes with this change.Reproduction
ruby -I lib/rb/lib repro.rbwith Ruby 4.0.9 on master (50242d7):With this change: