Skip to content

[v0.11.0] Do not fail closing a partly read response that the server ended early (backport #3217) - #3234

Open
polyglotAI-bot wants to merge 1 commit into
v0.11.0from
polyglot/backport-v0.11.0-partly-read-response-close
Open

polyglotAI-bot wants to merge 1 commit into
v0.11.0from
polyglot/backport-v0.11.0-partly-read-response-close

Conversation

@polyglotAI-bot

@polyglotAI-bot polyglotAI-bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Backports #3217 from main to v0.11.0, as requested by @chernser in #3231 (comment):

@polyglotAI-bot I'm a maintainer and asking you do the PR to v0.11.0 for me I'll review

Issue: #3231 (a closing keyword has no effect on a PR into a non-default branch, so close the issue manually after merge).

Cherry-picked PR

PR Merge commit on main Change Backport commit
#3217 848b3116b ResultSet#close() / QueryResponse#close() do not fail when the server ended a partly read response early (#3203) 536f9842c (clean)

Command: git cherry-pick -x -m 1 848b3116b. The commit keeps its original author and records its source commit.

Conflicts

None. The diff (4 files, +154/−2) is identical to the diff of #3217 on main, hunk by hunk. Only the blob index hashes are different. The branch has no other changes.

Note: history/latest/3203.md (the release-note fragment of #3217) creates history/latest/ on this branch, because v0.11.0 does not have that directory. I kept the file as is, because the request is git tools only. Move it into history/0_11_0_release/CHANGELOG.md if the branch needs a different release-note layout.

Test

Done in a devbox (JDK 17 + JDK 8 toolchain, ClickHouse server 26.9.1):

  • mvn -B -pl client-v2,jdbc-v2 -am -DskipTests -Dmaven.javadoc.skip=true install: BUILD SUCCESS.
  • jdbc-v2 ResultSetImplTest (integration): 20 run, 0 failures. This includes the 2 new testCloseNotFullyReadResultSet cases.
  • client-v2 HttpTransportTests (integration): 96 run, 69 pass. The 3 new testClosingNotFullyReadResponse cases pass.
  • The bug is present on v0.11.0: with only HttpAPIClientHelper.java reverted to v0.11.0, the 3 new testClosingNotFullyReadResponse cases fail.
  • The other 27 HttpTransportTests failures are the same with and without this change. They are environment failures: the tests connect to the hardcoded localhost:8123 / localhost:8443, which are not reachable in this environment (the server has a different host name), and testServerErrorHandling expects error code 636 where this server returns 400. CI runs them against a local server.

This PR adds no tests, docs or version bump other than those in #3217.

Checklist

🤖 Generated with Claude Code


Note

Medium Risk
Changes HTTP response teardown for failed mid-stream queries; behavior differs only on close after partial reads, but affects shared transport used by client-v2 and jdbc-v2.

Overview
Backports the fix for #3203 so closing a partly read query response no longer surfaces misleading HTTP chunk errors (Premature end of chunk coded message body…) when ClickHouse ends the body early after a mid-stream query failure.

In HttpAPIClientHelper, response bodies are wrapped in a ResponseBodyInputStream that swallows ConnectionClosedException on close() (logged at DEBUG with queryId) once a data stream was opened; TransportResponseImpl.close() applies the same rule. Active reads still fail as before, and paths that never open the result stream (Client#execute, Statement#executeUpdate) still propagate ConnectionClosedException so failures remain visible.

Adds integration tests for client-v2 HTTP transport (compression variants) and jdbc-v2 ResultSet#close(), plus a release-note entry in history/latest/3203.md.

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

…y-read-response

[client-v2, jdbc-v2] Do not fail closing a partly read response that the server ended early

(cherry picked from commit 848b311)
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.

2 participants