Skip to content

[fix] send the alert after a failed client handshake - #400

Closed
toabctl wants to merge 1 commit into
jruby:masterfrom
toabctl:wt-fix-shutdown-alert
Closed

toabctl wants to merge 1 commit into
jruby:masterfrom
toabctl:wt-fix-shutdown-alert

Conversation

@toabctl

@toabctl toabctl commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #399.

When the client rejects the server certificate, BCJSSE throws the stored handshake failure on the first wrap() and emits the buffered alert only on the next one. doShutdown stopped after the first, so the alert was never sent and the server's accept blocked while the client kept its socket open. doShutdown now wraps once more after an SSLException.

Adds test_client_verify_failure_sends_alert_to_server (TLS 1.2 and 1.3). It fails without the change; test/ssl/test_ssl.rb and the other test/ssl files pass with it (JRuby 10, OpenJDK 21).

When the client rejects the server certificate, BCJSSE buffers the
fatal alert and stores the failure: the next wrap() throws it, and
only the wrap() after that emits the alert. doShutdown gave up after
the first wrap() threw, so the alert was never sent. A server whose
client kept the TCP socket open then blocked in accept indefinitely.

Before 0.19.2 the server did not hang, but only because shutdown
re-sent stale output (the ClientHello and zero bytes), which the
server rejected.

doShutdown now wraps once more after an SSLException while outbound
is not done, which flushes the buffered alert; the server fails with
certificate_unknown.
@kares

kares commented Nov 4, 2026

Copy link
Copy Markdown
Member

thanks included your commit #402 with some further changes, closing as duplicate

@kares kares closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server accept hangs when the client rejects the certificate (since 0.19.2)

2 participants