-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: invalidated config should retain error #1068
Conversation
When a TLS handshake fails, the client would invalidate the configuration without recording the associated error. When the liveness check runs, it would panic when trying to print the invalidated configuration's error because the error was nil. This commit ensures that when the proxy invalidates a configuration, it includes the error. Fixes #1065.
b7b8025
to
7db7142
Compare
proxy/proxy/connect_tls_117.go
Outdated
@@ -38,7 +39,8 @@ func (c *Client) connectTLS( | |||
// this file is conditionally compiled on only Go versions >= 1.17. | |||
if err := ret.HandshakeContext(ctx); err != nil { | |||
_ = ret.Close() | |||
c.invalidateCfg(cfg, instance) | |||
err = fmt.Errorf("config invalidated after TLS handshake failed, error = %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider moving the wrapping to add context ("config invalidated because error:") inside the invalidate function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Should have thought of that myself.
When a TLS handshake fails, the client would invalidate the
configuration without recording the associated error. When the liveness
check runs, it would panic when trying to print the invalidated
configuration's error because the error was nil. This commit ensures
that when the proxy invalidates a configuration, it includes the error.
Fixes #1065.