Skip to content

Avoid retaining failed TLS connections in sender - #47

Merged
markmnl merged 2 commits into
mainfrom
fix/sender-tls-connection
Sep 17, 2026
Merged

markmnl merged 2 commits into
mainfrom
fix/sender-tls-connection

Conversation

@markmnl

@markmnl markmnl commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Failed TLS dials return a nil *tls.Conn. Assigning that pointer to net.Conn left the interface non-nil, so an expired certificate or other failure on every target IP could panic in RemoteAddr and the deferred Close.

Extract the IP dial loop and return a connection only after a successful TLS handshake. Exhausting the IPs returns a nil interface, reaching the existing retry/backoff path. The timeout, IP order, certificate verification, TLS configuration, and protocol handling are unchanged.

Regression tests use real loopback TLS servers: a trusted but expired certificate yields no retained connection, and an unreachable first IP falls back to a usable connection with verified TLS 1.3 and fmsg/1 ALPN. The expired-certificate test reproduced the non-nil interface failure before the fix.

Remove the README's "Immutable message finalization and upgrades" section.

Integration prerequisite: fmsg-docker #22 upgrades the harness builder images to Go 1.27, which the current components require. Merge that PR before this one. The matching fix/sender-tls-connection branch in fmsg-docker points to its existing tested changes so this PR's integration check can run while the prerequisite awaits approval.

Validation passed on Go 1.27.1:

  • go build ./...
  • go vet ./...
  • go test -race ./..., including the PostgreSQL integration tests against an isolated local instance.
  • All 15 fmsg-docker integration tests using the Go 1.27 companion harness: PR-triggered successful run.

@markmnl
markmnl merged commit 279061d into main Sep 17, 2026
2 checks passed
@markmnl
markmnl deleted the fix/sender-tls-connection branch September 17, 2026 02:44
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.

1 participant