Repository navigation
fluent: fix panic on failing TLS connect - #144
Merged
Merged
Conversation
mrkamel
force-pushed
the
fix-tls-connect-typed-nil
branch
from
October 1, 2026 08:37
e55e47d to
b818fd5
Compare
Dial into a local in each connect branch and assign f.conn only once the dial has succeeded. Fixes fluent#119 Signed-off-by: Benjamin Vetter <benjamin.vetter@nymcard.com>
mrkamel
force-pushed
the
fix-tls-connect-typed-nil
branch
from
October 1, 2026 08:42
b818fd5 to
a5b870f
Compare
Contributor
|
cc @cosmo0920 ptal |
cosmo0920
approved these changes
Oct 2, 2026
Contributor
|
Thanks. It's reasonable change to me. |
Contributor
|
Doh! Meant to comment on the PR, but did on the ticket 🙈 Thanks @cosmo0920 ! Any chance on a new patch release? Then we could be able to close out moby/moby#47709 on our side I opened one minor PR to remove uses of the deprecated io/ioutil, and |
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.
Fix for #119 supported by Claude Code
Problem
tls.DialWithDialerreturns a concrete*tls.Conn, so assigning itstraight to
f.connstored a typed nil on failure:f.conn != nilheld while the pointer behind it was nil. Two nil derefs followed, both
reachable by pointing a
tlslogger at an endpoint that's down:close()calledClose()on the nil*tls.Conn.syncConnectWithRetryskipped the reconnect, sosyncWriteMessagedereferenced it.
Fix
Dial into a local in each branch and assign
f.connonly after the dialsucceeds; on error
connect()returns early without touching it. Theold implicit "clear
f.connon failure" was dead — all three callersalready enter with it nil.
latestReconnectTimeis unchanged. Thetcp/unixbranches are retargeted for consistency only; they werenever affected.
Testing
TestNoPanicOnFailingTLSConnectpoints a sync TLS logger at a closedloopback port and covers both crashes (two
Posts, deferredClose).It panics on the old code, passes with the fix.
go test ./fluent/ -race -count=1passes.