[ 
https://issues.apache.org/jira/browse/THRIFT-6072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer resolved THRIFT-6072.
--------------------------------
    Fix Version/s: 0.24.0
         Assignee: Jens Geyer
       Resolution: Fixed

> Ruby ThreadedServer and SimpleServer crash on SSL accept errors
> ---------------------------------------------------------------
>
>                 Key: THRIFT-6072
>                 URL: https://issues.apache.org/jira/browse/THRIFT-6072
>             Project: Thrift
>          Issue Type: Bug
>          Components: Ruby - Library
>            Reporter: Jens Geyer
>            Assignee: Jens Geyer
>            Priority: Major
>             Fix For: 0.24.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {{ThreadedServer}} and {{SimpleServer}} call {{@server_transport.accept}} 
> without rescuing accept-level exceptions. When a plain TCP probe (e.g., the 
> cross-test runner's {{ensure_socket_open}} readiness check) connects to an 
> SSL port and immediately disconnects, the SSL handshake fails with 
> {{OpenSSL::SSL::SSLError}}. This exception is not caught by the inner 
> per-client rescue ({{Thrift::TransportException, 
> Thrift::ProtocolException}}), so it propagates through the {{loop do}}, hits 
> the outer {{ensure}}, and the server exits.
> Observed as cross-test flake: {{rb-cpp accel-binary buffered-ip-ssl 
> failure(64)}} where {{failure(64)}} means the server process exited before 
> the client was started (RESULT_ERROR in the cross-test runner).
> {{ThreadPoolServer}} is already safe because it has a broad {{rescue => e}} 
> around the entire worker block. {{NonblockingServer}} rescues 
> {{Errno::ECONNRESET}}. Only {{ThreadedServer}} and {{SimpleServer}} are 
> exposed.
> *Fix:* Add a targeted rescue around the {{accept}} call in both servers to 
> catch {{Errno::ECONNRESET}}, {{Errno::EPIPE}}, and {{OpenSSL::SSL::SSLError}} 
> (checked via {{defined?}} to avoid a hard OpenSSL dependency), then {{next}} 
> to retry the accept loop. All other exceptions (including {{IOError}} on 
> server socket close) propagate normally.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to