kpumuk opened a new pull request, #3704:
URL: https://github.com/apache/thrift/pull/3704

   <!-- Explain the changes in the pull request below: -->
   Ruby JSONProtocol raised `EOFError` after reading a complete UUID string 
shorter than 36 characters. Unlike an actual truncated transport value, this 
represented malformed protocol data, so the exception escaped SimpleServer's 
per-connection Thrift exception boundary and stopped the serving loop.
   
   This change lets the existing UUID validator classify complete malformed 
UUID strings as `ProtocolException::INVALID_DATA`. SimpleServer can then reject 
the malformed connection and continue accepting clients. Actual truncated JSON 
input retains its existing `EOFError` behavior, and valid UUID values continue 
to round-trip.
   
   ## Benchmarks
   
   Ruby 4.0.6, pure-Ruby implementation, 200,000 valid JSON UUID decodes per 
trial, seven trials:
   
   ```sh
   ruby -Ilib -rthrift -e 'payload = 
%q("550e8400-e29b-41d4-a716-446655440000"); iterations = 200000; times = 
7.times.map do; GC.start; started = 
Process.clock_gettime(Process::CLOCK_MONOTONIC); iterations.times { 
Thrift::JsonProtocol.new(Thrift::MemoryBufferTransport.new(payload.dup)).read_uuid
 }; Process.clock_gettime(Process::CLOCK_MONOTONIC) - started; end; sorted = 
times.sort; puts sorted[times.length / 2]'
   ```
   
   | Revision | Median |
   | --- | ---: |
   | master `a9663bc6661a5dd1d99d629e1f269c1907592a1a` | 3.007022 s |
   | this change | 2.908533 s (-3.28%) |
   
   The microbenchmark includes transport and protocol object allocation, so 
small deltas should be treated as noise. It shows no regression in the 
valid-UUID path.
   
   <!-- 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-6140) 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]

Reply via email to