kpumuk opened a new pull request, #3307:
URL: https://github.com/apache/thrift/pull/3307
<!-- Explain the changes in the pull request below: -->
Currently `Thrift::NonblockingServer` does not work when configured with SSL
sockets:
```
$ THRIFT_TLS=true bundle exec rake benchmark /usr/local/bin/ruby
benchmark/benchmark.rb
Starting server...
#<Thread:0x0000ffff817cb718 benchmark/server.rb:87 run> terminated with
exception (report_on_exception is true):
/thrift/src/lib/rb/lib/thrift/server/nonblocking_server.rb:48:in
'Kernel#select': can't convert Thrift::SSLServerSocket to IO
(Thrift::SSLServerSocket#to_io gives OpenSSL::SSL::SSLServer) (TypeError)
rd, = select([@server_transport], nil, nil, 0.1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from
/thrift/src/lib/rb/lib/thrift/server/nonblocking_server.rb:48:in 'block in
Thrift::NonblockingServer#serve'
from
/thrift/src/lib/rb/lib/thrift/server/nonblocking_server.rb:45:in 'Kernel#loop'
from
/thrift/src/lib/rb/lib/thrift/server/nonblocking_server.rb:45:in
'Thrift::NonblockingServer#serve'
from benchmark/server.rb:88:in 'block in Server.start_server'
```
This is happening because `#to_io` on the SSL socket returns the wrapped
handler instead of the underlying socket.
After the change we get a clear output:
```
$ THRIFT_TLS=true bundle exec rake benchmark
/usr/local/bin/ruby benchmark/benchmark.rb
Starting server...
Spawning benchmark processes...
Collecting output...
Translating output...
Analyzing output...
Server class: Thrift::NonblockingServer
Server interpreter: ruby
Client interpreter: ruby
Protocol type: binary
Socket class: Thrift::SSLSocket
Number of processes: 40
Clients per process: 5
Calls per client: 50
Using fastthread: no
Connection failures: 0
Connection errors: 0
Average time per call: 0.0033 seconds
Average time per client (50 calls): 0.2159 seconds
Total time for all calls: 32.5091 seconds
Real time for benchmarking: 2.7874 seconds
Shortest call time: 0.0001 seconds
Longest call time: 0.0213 seconds
Shortest client time (50 calls): 0.0560 seconds
Longest client time (50 calls): 0.3463 seconds
```
<!-- We recommend you review the checklist/tips before submitting a pull
request. -->
- [ ] Did you create an [Apache
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?
([Request account here](https://selfserve.apache.org/jira-account.html), not
required for trivial changes)
- [ ] 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]