fix: close connections leaked during pool shutdown (#1831)#1833
fix: close connections leaked during pool shutdown (#1831)#1833Laotree wants to merge 3 commits intoClickHouse:mainfrom
Conversation
Two bugs allowed TCP connections to escape cleanup when Close() was called: 1. clickhouse.Close() drained the idle pool before marking it closed, leaving a window where release() could Put() connections back. Fixed by storing closed=true first, then draining. 2. connPool.Put() silently dropped connections when the pool was already closed instead of closing them, leaking the underlying TCP connection. Fixed by calling conn.close() before returning. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
addresses this issue #1831 |
SummaryThis PR fixes two distinct TCP connection-leak bugs in the pool shutdown path. Bug 1: Should fix
Nits
VerdictApprove — the two-line logic fix is correct and the test update verifies the previously-silently-dropped connection is now closed. The should-fix items (regression file in |
Two bugs allowed TCP connections to escape cleanup when Close() was called:
clickhouse.Close() drained the idle pool before marking it closed, leaving a window where release() could Put() connections back. Fixed by storing closed=true first, then draining.
connPool.Put() silently dropped connections when the pool was already closed instead of closing them, leaking the underlying TCP connection. Fixed by calling conn.close() before returning.
Summary
Checklist
Delete items not relevant to your PR: