GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fixed: Call `handshakeFailure` for TLS timeouts and early closes by chrisvest · Pull Request #18363 · netty/netty

Conversation

@chrisvest

@chrisvest chrisvest commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Motivation:

A TLS handshake timeout or early connection close can produce a failed SslHandshakeCompletionEvent without an SSL DecoderException. ApplicationProtocolNegotiationHandler waits for that exception before calling handshakeFailure. In our proxy, this leaves the protocol-negotiation promise unresolved unless we override event handling separately.

Modification:

This PR calls handshakeFailure for completion events caused by SslHandshakeTimeoutException or ClosedChannelException. Other TLS failures retain their existing exception and close handling.

The handler stays installed to consume later SSL decoder exceptions (#10342), without calling the failure callback twice.

Result:

Timeouts and early closes reach the failure callback without requiring a downstream event-handling override.


The PR #18323 was reverted and reapplied in a fixed version.

The original change caused test failures in the Netty 4.2 SNAPSHOT builds of ServiceTalk: https://github.com/apple/servicetalk/actions/runs/42840482508/job/129914156063

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chrisvest
Revert "Call handshakeFailure for failed TLS completion events (#18323
9b26272
)"

This reverts commit ce30707.
@chrisvest chrisvest added this to the 4.2.21.Final milestone Nov 12, 2026
@chrisvest

chrisvest commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

FYI @gavinbunney

gavinbunney reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gavinbunney

gavinbunney commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Thanks @chrisvest - I've opened #18364 against this branch with a narrower fix to retain the behavior that ServiceTalk (I think?) is relying on. It only calls handshakeFailure directly for timeouts/early-close completion events, leaving other TLS failures on their existing handlers.

i.e. rather than unconditionally calling:

try {
    super.userEventTriggered(ctx, evt);
} finally {
    notifyHandshakeFailure(ctx, cause);
}

it is now:

if (cause instanceof SslHandshakeTimeoutException || cause instanceof ClosedChannelException) {
    try {
        super.userEventTriggered(ctx, evt);
    } finally {
        notifyHandshakeFailure(ctx, cause);
    }
}

Also added a regression test for the TLS control-write failure case.

chrisvest reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gavinbunney
Call handshakeFailure for TLS timeouts and early closes (#18364)
585491d
Motivation:

A TLS handshake timeout or early connection close can produce a failed
`SslHandshakeCompletionEvent` without an SSL `DecoderException`.
`ApplicationProtocolNegotiationHandler` waits for that exception before
calling `handshakeFailure`. In our proxy, this leaves the
protocol-negotiation promise unresolved unless we override event
handling separately.

Modification:

This PR calls `handshakeFailure` for completion events caused by
`SslHandshakeTimeoutException` or `ClosedChannelException`. Other TLS
failures retain their existing exception and close handling.

The handler stays installed to consume later SSL decoder exceptions
(#10342), without calling the failure callback twice.

Result:

Timeouts and early closes reach the failure callback without requiring a
downstream event-handling override.
@chrisvest chrisvest changed the title Revert "Call handshakeFailure for failed TLS completion events" Fixed: Call handshakeFailure for TLS timeouts and early closes Nov 13, 2026
@chrisvest chrisvest added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Nov 13, 2026
@chrisvest

chrisvest commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Updated the title and description of this PR with the fix PR that was merged into this one.

gavinbunney reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest
chrisvest enabled auto-merge (squash) November 13, 2026 01:22
@chrisvest
chrisvest merged commit 418ec43 into 4.2 Nov 13, 2026
32 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest
chrisvest deleted the revert-18323-gavin/fix-alpn-handshake-failures branch November 13, 2026 02:39
@testlens-app

testlens-app Bot commented Nov 13, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 585491d
▶️ Tests: 149466 executed
⚪️ Checks: 31/31 completed


Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 5.0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 4.1.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 13, 2026
Port 5.0: Call handshakeFailure for TLS timeouts and early closes (#18363) #18366
Merged
Port 4.1: Call handshakeFailure for TLS timeouts and early closes (#18363) #18367
Merged
normanmaurer added a commit that referenced this pull request Nov 13, 2026
@normanmaurer @chrisvest @gavinbunney
Port 5.0: Call handshakeFailure for TLS timeouts and early closes (#…
a5e0bef
…18363) (#18366)

Motivation:

Port of #18363 to 5.0. A TLS handshake timeout or early connection close
can produce a failed `SslHandshakeCompletionEvent` without an SSL
`DecoderException`. `ApplicationProtocolNegotiationHandler` waits for
that exception before calling `handshakeFailure`, which can leave
protocol negotiation unresolved.

Modification:

Cherry-pick of 418ec43 from 4.2. It conflicted with the earlier 5.0
port of #18323 (#18328), so the 4.2 versions of
`ApplicationProtocolNegotiationHandler` and its test were taken and
re-adapted to the 5.0 handler API (`ChannelInboundHandler`,
`channelShutdown`, `CompletionHandler`).

`handshakeFailure` is now called for completion events caused by
`SslHandshakeTimeoutException` or `ClosedChannelException`. Other TLS
failures keep their existing exception and close handling. The handler
stays installed to consume later SSL decoder exceptions (#10342),
without calling the failure callback twice.

Result:

Timeouts and early closes reach the failure callback.
`ApplicationProtocolNegotiationHandlerTest` passes.

Co-authored-by: Chris Vest <[email protected]>
Co-authored-by: Gavin Bunney <[email protected]>
normanmaurer added a commit that referenced this pull request Nov 13, 2026
@normanmaurer @chrisvest @gavinbunney
Port 4.1: Call handshakeFailure for TLS timeouts and early closes (#…
a2e227f
…18363) (#18367)

Motivation:

Port of #18363 to 4.1. A TLS handshake timeout or early connection close
can produce a failed `SslHandshakeCompletionEvent` without an SSL
`DecoderException`. `ApplicationProtocolNegotiationHandler` waits for
that exception before calling `handshakeFailure`, which can leave
protocol negotiation unresolved.

Modification:

Cherry-pick of 418ec43 from 4.2. The main-code change applied
cleanly. The test file conflicted with the earlier 4.1 port of #18323
(#18327), so the 4.2 version of
`ApplicationProtocolNegotiationHandlerTest` was taken and adapted to the
Java 6 baseline (no lambdas/streams, `final` captured locals).

`handshakeFailure` is now called for completion events caused by
`SslHandshakeTimeoutException` or `ClosedChannelException`. Other TLS
failures keep their existing exception and close handling. The handler
stays installed to consume later SSL decoder exceptions (#10342),
without calling the failure callback twice.

Result:

Timeouts and early closes reach the failure callback.
`ApplicationProtocolNegotiationHandlerTest` passes.

Co-authored-by: Chris Vest <[email protected]>
Co-authored-by: Gavin Bunney <[email protected]>
@chrisvest chrisvest removed needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Nov 13, 2026
@lhotari lhotari mentioned this pull request Nov 17, 2026
[improve][build] Upgrade Netty to 4.2.21.Final to restore the aarch64 glibc floor and pick up bug fixes apache/pulsar#27654
Merged
1 of 11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.21.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@chrisvest @gavinbunney @netty-project-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.