kpumuk opened a new pull request, #3743:
URL: https://github.com/apache/thrift/pull/3743
<!-- Explain the changes in the pull request below: -->
Ruby's `FramedTransport` accepts a frame whose declared payload length is
zero. Its optimized read methods then operate on an empty buffer and leak
native/pure-Ruby-specific exceptions. In `SimpleServer`, those raw exceptions
escape the connection loop and close the listener.
This change rejects zero-length frames at the transport boundary with
`TransportException::END_OF_FILE`. The same typed behavior now applies to
`read`, `read_byte`, and `read_into_buffer`, allowing `SimpleServer` to close
the malformed connection while continuing to accept later requests.
## Benchmarks
A temporary Ruby stdlib harness read 200,000 independent 32-byte frames
through `FramedTransport` over `MemoryBufferTransport`. Both revisions used
Ruby 4.0.6 in the same worktree container, with 5 warmup runs and 15 measured
trials.
Command: `docker exec --workdir /thrift/src/lib/rb thrift-3422 bundle exec
ruby -Ilib /thrift/src/.rb-zero-frame-benchmark.rb`
| Revision | Median | Throughput |
| --- | ---: | ---: |
| `upstream/master` (`04c87e89a`) | 0.095469 s | 2,094,925 frames/s |
| Proposed change | 0.100292 s | 1,994,170 frames/s |
The proposed median was 5.1% slower and throughput was 4.8% lower in this
deliberately frame-overhead-heavy workload. The harness uses unusually small
in-memory frames and excludes socket, protocol, and handler work, so it
represents a worst-case view of the added per-frame integer check.
<!-- We recommend you review the checklist/tips before submitting a pull
request. -->
- [x] Did you create an [Apache
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?
[THRIFT-6155](https://issues.apache.org/jira/browse/THRIFT-6155)
- [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]