Repository navigation
[v0.11.0] Do not fail closing a partly read response that the server ended early (backport #3217) - #3234
Conversation
…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)
|
@polyglotAI-bot sync from |
chernser
left a comment
There was a problem hiding this comment.
sync with v0.11.0 to fix the CI build
…v0.11.0-partly-read-response-close
|
@chernser Done. I merged
|
TriageCategory: Summary What this impacts
Concerns
Required reviewer action
|
chernser
left a comment
There was a problem hiding this comment.
Update the https://github.com/ClickHouse/clickhouse-java/blob/v0.11.0/history/0_11_0_release/CHANGELOG.md with bug fix for this PR
Add the bug fix entry to history/0_11_0_release/CHANGELOG.md, as requested in review. Remove history/latest/3203.md: the entry is now in the release changelog, and v0.11.0 has no history/latest/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The code and test changes are not changed. CI runs again on the new head. |
Summary
Backports #3217 from
maintov0.11.0, as requested by @chernser in #3231 (comment):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
main848b3116bResultSet#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 code and test changes are identical to the diff of #3217 on
main, hunk by hunk. Only the blob index hashes are different.Release notes (changed in review)
As requested in review, the release note of #3217 is in
history/0_11_0_release/CHANGELOG.md(end of## Bug Fixes), with the same text.history/latest/3203.mdis removed from this PR, becausev0.11.0has nohistory/latest/directory. Commitc6d853990.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-v2ResultSetImplTest(integration): 20 run, 0 failures. This includes the 2 newtestCloseNotFullyReadResultSetcases.client-v2HttpTransportTests(integration): 96 run, 69 pass. The 3 newtestClosingNotFullyReadResponsecases pass.v0.11.0: with onlyHttpAPIClientHelper.javareverted tov0.11.0, the 3 newtestClosingNotFullyReadResponsecases fail.HttpTransportTestsfailures are the same with and without this change. They are environment failures: the tests connect to the hardcodedlocalhost:8123/localhost:8443, which are not reachable in this environment (the server has a different host name), andtestServerErrorHandlingexpects 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, and the changelog entry above.
Checklist
🤖 Generated with Claude Code
Note
Medium Risk
Changes HTTP response teardown for failed mid-stream queries; behavior is narrowed (swallow close errors only when a body stream was opened) but affects connection reuse and error surfacing for all HTTP users.
Overview
Backports the fix for closing partly read HTTP query results when ClickHouse ends the response body early (e.g. query fails after rows were already streamed). Closing used to trigger Apache HttpClient’s body drain and could surface
ConnectionClosedException/ “Premature end of chunk coded message body” onQueryResponse#close(),ResultSet#close(), or reader close even though the real failure should appear while reading.HTTP transport wraps the response body in
ResponseBodyInputStreamand treatsConnectionClosedExceptionon close as DEBUG-only when a data stream was opened; errors while reading are unchanged. If the body was never opened (Client#execute/executeUpdate), close still propagates the failure so commands without a result set are not silently ignored.Adds integration tests for client-v2 (several compression modes) and jdbc-v2 (
RowBinaryWithNamesAndTypes,JSONEachRow), plus a v0.11.0 changelog entry for #3203.Reviewed by Cursor Bugbot for commit c6d8539. Bugbot is set up for automated code reviews on this repo. Configure here.