Skip to content

logging: close the redialed conn when writing to it fails - #8323

Closed
BenMacha wants to merge 1 commit into
caddyserver:masterfrom
BenMacha:fix-net-writer-redial-leak
Closed

BenMacha wants to merge 1 commit into
caddyserver:masterfrom
BenMacha:fix-net-writer-redial-leak

Conversation

@BenMacha

@BenMacha BenMacha commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

A failed write on a freshly dialed connection leaked the connection and
dropped the entry; close it and fall back to stderr, as when dialing fails.

No test: making a write fail reliably on a freshly dialed TCP connection would be flaky.

Assistance Disclosure

The bug was found during a code review done with Claude Code (Anthropic), which also drafted the fix and the test. I reviewed the change, can explain every line, and ran go test -race -short on the affected package before opening this PR.

A failed write on a freshly dialed connection leaked the connection and
dropped the entry; close it and fall back to stderr, as when dialing fails.
@caddy-cla

caddy-cla Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

✅ Contributor License Agreement

All identified contributors have signed the CLA. Thank you!

@steadytao

Copy link
Copy Markdown
Member

A fake connection can most certainly deterministically fail the post-redial write.

@steadytao steadytao closed this Nov 3, 2026
@steadytao steadytao added the not reviewable ⛔ Cost of reviewing outweighs the implementation, this may be due to various reasons label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not reviewable ⛔ Cost of reviewing outweighs the implementation, this may be due to various reasons

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants