Skip to content

[client-v2] Keep connection pool open after request body errors - #3484

Open
7487 wants to merge 1 commit into
ClickHouse:mainfrom
7487:fix/issue-3453-client-v2-an-error-thrown-while-an-inser
Open

7487 wants to merge 1 commit into
ClickHouse:mainfrom
7487:fix/issue-3453-client-v2-an-error-thrown-while-an-inser

Conversation

@7487

@7487 7487 commented Dec 2, 2026 •

Copy link
Copy Markdown

Summary

  • Keep an Error thrown by a streaming request-body writer from crossing Apache HttpClient's execution boundary, where it would close the shared connection manager.
  • Preserve the public contract by rethrowing the same Error instance after Apache has cleaned up the failed request.
  • Add a WireMock regression test proving a later request through the same helper still succeeds, plus the feature-contract and history updates.

No public API, configuration, default, retry, or wire-format behavior changes.

Closes #3453

Verification

  • TDD reproduction before the fix: the follow-up request failed with IllegalStateException: Connection pool shut down.
  • HttpAPIClientHelperTest: 54 tests passed.
  • client-v2 unit tests: 996 tests passed.
  • Full client-v2 integration run: 1,893/1,896 tests passed; the same three environment-sensitive failures reproduced unchanged on a clean 27d63e9 worktree. A final verify excluding those three affected test classes passed 1,756/1,756 integration tests and 996/996 unit tests.
  • Spotless passed for both touched Java files; git diff --check passed.
  • Full 10-module mvn -Dj8 -DskipTests install: all modules built and packaged successfully.

The repository-wide Spotless invocation currently reports 74 pre-existing files; neither touched Java file is among the violations when checked directly.

Checklist


Note

Medium Risk
Changes error-handling on the streaming insert HTTP path and connection-pool lifecycle; regression test covers the scenario but this is core transport behavior.

Overview
Fixes a bug where an Error from a streaming insert body callback could escape into Apache HttpClient and shut down the shared connection pool, breaking every later request on the same Client.

For callback-driven requests, HttpAPIClientHelper now captures the original Error, surfaces failure to Apache as an IOException, and rethrows the same Error instance to the caller after the request path finishes. No public API or wire behavior changes.

A WireMock regression test confirms the follow-up request still succeeds; features and changelog document isolated streaming-insert failures.

Reviewed by Cursor Bugbot for commit 2ef7ddc. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: 7487 <1042653432@qq.com>
@7487
7487 requested review from a team and mzitnik as code owners December 2, 2026 03:10
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.

[client-v2] An Error thrown while an insert writes its body shuts down the connection pool, so every later request of the Client fails

1 participant