Skip to content

Auto-port 4.1: Route synchronous onLookupComplete exceptions via fireExceptionCaught#16824

Merged
normanmaurer merged 1 commit into
4.1from
auto-port-pr-16794-to-4.1
May 19, 2026
Merged

Auto-port 4.1: Route synchronous onLookupComplete exceptions via fireExceptionCaught#16824
normanmaurer merged 1 commit into
4.1from
auto-port-pr-16794-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #16794 to 4.1
Cherry-picked commit: 4ce9f17


Motivation:

Exceptions thrown synchronously by the user-supplied onLookupComplete
callback in AbstractSniHandler subclasses are caught by
SslClientHelloHandler.decode()'s outer catch (Exception) and turned
into a select(ctx, null) retry, falling back to the default
SslContext. The user-callback exception never reaches the pipeline.

The async branch of the same select() method already routes such
exceptions via ctx.fireExceptionCaught(...). The sync branch lacks
this routing.

Modification:

  • Add an inner try/catch around the synchronous onLookupComplete(...) call in SslClientHelloHandler.select(), mirroring the routing the async FutureListener already performs.
  • Add SslClientHelloHandlerTest covering the sync path.
  • Update SniHandlerTest.testNonAsciiServerNameParsing to reflect the new routing behaviour (the exception is now fired on the pipeline rather than thrown directly from writeInbound).

Result:

User-callback exceptions are routed via fireExceptionCaught regardless
of whether the lookup Future is completed synchronously or
asynchronously. The silent select(ctx, null) retry path is no longer
triggered by user-callback exceptions.

Fixes #16790

…#16794)

Motivation:

  Exceptions thrown synchronously by the user-supplied onLookupComplete
  callback in AbstractSniHandler subclasses are caught by
  SslClientHelloHandler.decode()'s outer catch (Exception) and turned
  into a select(ctx, null) retry, falling back to the default
  SslContext. The user-callback exception never reaches the pipeline.

  The async branch of the same select() method already routes such
  exceptions via ctx.fireExceptionCaught(...). The sync branch lacks
  this routing.

  Modification:

- Add an inner try/catch around the synchronous onLookupComplete(...)
call in SslClientHelloHandler.select(), mirroring the routing the async
FutureListener already performs.
  - Add SslClientHelloHandlerTest covering the sync path.
- Update SniHandlerTest.testNonAsciiServerNameParsing to reflect the new
routing behaviour (the exception is now fired on the pipeline rather
than thrown directly from writeInbound).

  Result:

  User-callback exceptions are routed via fireExceptionCaught regardless
  of whether the lookup Future is completed synchronously or
  asynchronously. The silent select(ctx, null) retry path is no longer
  triggered by user-callback exceptions.

  Fixes #16790

Signed-off-by: Daeho Kwon <trewq231@naver.com>
(cherry picked from commit 4ce9f17)
@normanmaurer normanmaurer added this to the 4.1.134.Final milestone May 19, 2026
@normanmaurer normanmaurer merged commit 4c1cb1d into 4.1 May 19, 2026
17 of 19 checks passed
@normanmaurer normanmaurer deleted the auto-port-pr-16794-to-4.1 branch May 19, 2026 06:24
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.

3 participants