Propagate error from DotNetty TLS handshake failure to Akka.Remote#7824
Merged
Aaronontheweb merged 1 commit intoakkadotnet:v1.5from Sep 15, 2025
Merged
Conversation
Arkatufus
commented
Sep 15, 2025
Comment on lines
+67
to
+84
| public override void UserEventTriggered(IChannelHandlerContext context, object evt) | ||
| { | ||
| if (evt is TlsHandshakeCompletionEvent { IsSuccessful: false } tlsEvent) | ||
| { | ||
| var ex = tlsEvent.Exception ?? new Exception("TLS handshake failed."); | ||
| Log.Error(ex, "TLS handshake failed. Channel [{0}->{1}](Id={2})", | ||
| context.Channel.LocalAddress, context.Channel.RemoteAddress, context.Channel.Id); | ||
|
|
||
| // Best-effort surface to higher layers if listener already registered | ||
| NotifyListener(new UnderlyingTransportError(ex, | ||
| $"TLS handshake failed on channel [{context.Channel.LocalAddress}->{context.Channel.RemoteAddress}](Id={context.Channel.Id})")); | ||
|
|
||
| context.CloseAsync(); | ||
| return; // don't pass to next handlers | ||
| } | ||
|
|
||
| base.UserEventTriggered(context, evt); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Server side fix, listen for TLS handshake failure event and log/propagate it.
Comment on lines
+175
to
+191
| public override void UserEventTriggered(IChannelHandlerContext context, object evt) | ||
| { | ||
| if (evt is TlsHandshakeCompletionEvent tlsEvent) | ||
| { | ||
| if (tlsEvent.IsSuccessful) | ||
| { | ||
| _tlsHandshakePromise.TrySetResult(true); | ||
| } | ||
| else | ||
| { | ||
| var ex = tlsEvent.Exception ?? new Exception("TLS handshake failed."); | ||
| _tlsHandshakePromise.TrySetException(ex); | ||
| } | ||
| } | ||
|
|
||
| base.UserEventTriggered(context, evt); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Client side fix, listen for TLS handshake failure and log/propagate it.
Contributor
Author
|
Server side now logs the error appropriately: The client side logs the error appropriately: |
This was referenced Sep 15, 2025
This was referenced Sep 22, 2025
This was referenced Oct 20, 2025
This was referenced Oct 27, 2025
This was referenced Nov 6, 2025
This was referenced Nov 26, 2025
This was referenced Dec 12, 2025
This was referenced Jan 9, 2026
This was referenced Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #7823
Supercedes #7821
Summary
Changes
TlsHandshakeCompletionEventinTcpHandlers.UserEventTriggered:UnderlyingTransportErrorwhen possible.AssociateInternal)InvalidAssociationExceptionwith the TLS failure as inner exception on error.DotNettyTlsHandshakeFailureSpecto assert that server logs “TLS handshake failed …” at ERROR when cert lacks a private key and a client connects.Behavioral impact
Associatenow fails fast withInvalidAssociationExceptioncontaining the TLS error.