You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clientModule: the client (client-v2; with legacy: the v1 client)connectivityArea: connection, TLS, pool, timeouts, cancellation, transport, compressionenhancement
Recently we have found that while using queryRecords leads to error when user forget to close Records object what leads to a connection leaking. We need to review and put some guard rails even this a misuse problem.
We need to:
Think about detecting orphan response objects somehow
We need to put more information into ConnectionRequestTimeoutException because it indicates that pool is empty
We need to review Insert/Command operation code to make sure resource are release as soon as they can.
Triage
There are operations like execute and insert that do not need to read from response body. Once data is sent by user only confirmation is needed. Client gets this confirmation at the end of request or when server sends headers. Task here is to close in/out and release connection.
HTTP transport is problematic at this case because server response can be at the end of data transfer (if there is not much data) or at the middle of transfer when server responded but data still poured into output stream. Client controls request from its side but has nothing about data transfer as it is done by client. The only identification is that output stream is closed.
Recommendation: Keep open — feature needed
The third item is done on main: insert and execute release their connection before they return. The first two items still need work: detect a Records or QueryResponse that the caller does not close, and make the pool timeout error say that the pool is empty.
Status on main: Not supported on main — on 8480ca001, ClickHouse 26.11.4.11, with one pooled connection, a Records that is not closed makes the next query fail after 4 attempts: ConnectionInitiationException: Query request failed (attempt: 4, duration: 8007ms, queryId: null), cause ConnectionRequestTimeoutException: Timeout deadline: 2000 MILLISECONDS, actual: 2000 MILLISECONDS. An InsertResponse or CommandResponse that is not closed holds no connection.
Breaking change: No — can be done without a break.
Analysis: client-v2 has no check for a response that the caller does not close (no Cleaner or finalizer in client-v2/src/main). A pool timeout becomes a ConnectionInitiationException with the generic request message (HttpAPIClientHelper.java:1233). It is retried by default (ClientConfigProperties.java:231), and each retry quarantines the endpoint and logs "All endpoints are non-responsive" (ClientNodeSelector.java:50, :58), so the log points to the server, not to the pool. insert closes the response before it returns (Client.java:1655, :1883), and CommandResponse closes its QueryResponse in the constructor (CommandResponse.java:17).
Automated triage by Polyglot AI. A maintainer makes the final decision.
clientModule: the client (client-v2; with legacy: the v1 client)connectivityArea: connection, TLS, pool, timeouts, cancellation, transport, compressionenhancement
Activity
chernser commentedon Jun 1, 2026
Triage
There are operations like
executeandinsertthat do not need to read from response body. Once data is sent by user only confirmation is needed. Client gets this confirmation at the end of request or when server sends headers. Task here is to close in/out and release connection.HTTP transport is problematic at this case because server response can be at the end of data transfer (if there is not much data) or at the middle of transfer when server responded but data still poured into output stream. Client controls request from its side but has nothing about data transfer as it is done by client. The only identification is that output stream is closed.
polyglotAI-bot commentedon Nov 28, 2026
Recommendation: Keep open — feature needed
The third item is done on
main:insertandexecuterelease their connection before they return. The first two items still need work: detect aRecordsorQueryResponsethat the caller does not close, and make the pool timeout error say that the pool is empty.main: Not supported on main — on8480ca001, ClickHouse 26.11.4.11, with one pooled connection, aRecordsthat is not closed makes the next query fail after 4 attempts:ConnectionInitiationException: Query request failed (attempt: 4, duration: 8007ms, queryId: null), causeConnectionRequestTimeoutException: Timeout deadline: 2000 MILLISECONDS, actual: 2000 MILLISECONDS. AnInsertResponseorCommandResponsethat is not closed holds no connection.Errorduring an insert shuts down the pool).Analysis: client-v2 has no check for a response that the caller does not close (no
Cleaneror finalizer inclient-v2/src/main). A pool timeout becomes aConnectionInitiationExceptionwith the generic request message (HttpAPIClientHelper.java:1233). It is retried by default (ClientConfigProperties.java:231), and each retry quarantines the endpoint and logs "All endpoints are non-responsive" (ClientNodeSelector.java:50,:58), so the log points to the server, not to the pool.insertcloses the response before it returns (Client.java:1655,:1883), andCommandResponsecloses itsQueryResponsein the constructor (CommandResponse.java:17).Automated triage by Polyglot AI. A maintainer makes the final decision.