Repository navigation
fix: Fix resource leaks and shutdown handling in shared clients - #1244
Merged
Merged
Conversation
| } | ||
| if config.UseTls { | ||
| host, _, _ := net.SplitHostPort(addr) | ||
| tlsConn := tls.Client(conn, &tls.Config{ServerName: host, InsecureSkipVerify: true}) |
Member
Author
There was a problem hiding this comment.
This setting was already present before this PR. I kept it unchanged while making the TLS handshake cancellable on shutdown. Enabling certificate verification here could break existing deployments using self-signed certificates.
I suggest handling certificate verification and CA configuration in a separate PR
ShannonDing
approved these changes
Oct 10, 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.
What is the purpose of the change
Fix resource retention and blocked shutdown paths when producers and consumers are repeatedly created and closed within a long-running process, such as a sidecar.
Ensure that releasing the last shared client owner closes its transports, wakes pending requests, and allows background workers to exit. Rebuilding a client with previously used options must create an independent NameServer transport without retaining retired clients or blocking unrelated clients.
Brief changelog
Poll()calls on shutdown with the existingerrors.ErrService; preserveErrNoNewMsgfor normal timeouts.Verifying this change
Added regression tests covering:
Poll()cancellation.Validation passed on the final revision:
internal/...andproducer.Coverage percentage has not been measured.
Checklist
[ISSUE #<number>] <description>using the linked issue.