kpumuk opened a new pull request, #3705: URL: https://github.com/apache/thrift/pull/3705
<!-- Explain the changes in the pull request below: --> Ruby HeaderTransport exposed `Zlib::DataError` and `Zlib::BufError` when a Header frame contained invalid or truncated ZLIB data. Those implementation-specific errors bypassed the transport exception contract expected by callers. This change adapts only those decompression failures to `TransportException::UNKNOWN`. Valid compressed frames retain their existing behavior, and decompressed output exceeding the configured limit continues to raise `TransportException::SIZE_LIMIT`. ## Benchmarks Ruby 4.0.6, pure-Ruby implementation, 64 KiB valid compressed frames, 2,500 reads per trial, seven trials: ```sh ruby -Ilib -rthrift -rzlib -e 'payload = "A" * 65536; buffer = Thrift::MemoryBufferTransport.new; writer = Thrift::HeaderTransport.new(buffer); writer.add_transform(Thrift::HeaderTransformID::ZLIB); writer.write(payload); writer.flush; frame = buffer.read(buffer.available); iterations = 2500; times = 7.times.map do; GC.start; started = Process.clock_gettime(Process::CLOCK_MONOTONIC); iterations.times do; reader = Thrift::HeaderTransport.new(Thrift::MemoryBufferTransport.new(frame.dup)); raise "mismatch" unless reader.read(payload.bytesize) == payload; end; Process.clock_gettime(Process::CLOCK_MONOTONIC) - started; end; sorted = times.sort; puts sorted[times.length / 2]' ``` | Revision | Median | | --- | ---: | | master `a9663bc6661a5dd1d99d629e1f269c1907592a1a` | 0.516872 s | | this change | 0.500563 s (-3.15%) | The microbenchmark includes transport allocation and payload comparison, so small deltas should be treated as noise. It shows no regression in valid ZLIB frame reads. <!-- We recommend you review the checklist/tips before submitting a pull request. --> - [x] Did you create an [Apache Jira](https://issues.apache.org/jira/browse/THRIFT-6141) ticket? ([Request account here](https://selfserve.apache.org/jira-account.html), not required for trivial changes) - [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"? - [x] Did you squash your changes to a single commit? (not required, but preferred) - [x] Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"? - [ ] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources. <!-- The Contributing Guide at: https://github.com/apache/thrift/blob/master/CONTRIBUTING.md has more details and tips for committing properly. --> -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
