Skip to content

HIVE-29876: Close response streams in YarnQueueHelper - #6772

Open
xza-m wants to merge 1 commit into
apache:masterfrom
xza-m:HIVE-29876-close-response-streams
Open

HIVE-29876: Close response streams in YarnQueueHelper#6772
xza-m wants to merge 1 commit into
apache:masterfrom
xza-m:HIVE-29876-close-response-streams

Conversation

@xza-m

@xza-m xza-m commented Sep 10, 2026

Copy link
Copy Markdown

What changes were proposed in this pull request?

Use try-with-resources in YarnQueueHelper.handleUnexpectedStatusCode() to close the selected response stream after reading it, including when reading fails. Keep the error stream preferred over the fallback input stream.

Why are the changes needed?

HIVE-29876: the method reads the response body without closing its stream.

Does this PR introduce any user-facing change?

The response selection and error message format are unchanged. A failure closing the stream now propagates as an IOException; if reading also fails, the close exception is suppressed on the read exception.

How was this patch tested?

Added nine regression tests covering both stream paths, empty and missing responses, read failures, and close failures. Seven fail against the original implementation; all nine pass with the fix.

Ran the new tests and the existing TestTezSessionPool on JDK 21 with Maven 3.9.11:

mvn -B -ntp -Dscan=false -pl ql -am test \
  -Dtest=TestYarnQueueHelper,TestTezSessionPool \
  -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false

All 17 tests passed, and all 21 modules in the selected reactor succeeded. Apache RAT passed. Repository Checkstyle rules reported no findings in the new test and no new findings in the modified source. git diff --check passed.

TestTezSessionPool logged background-thread SessionState null-pointer exceptions; a separate run against the original source reproduced the same eight exceptions with all eight tests passing. The full Hive test suite was not run.

Close the error response stream and fallback input stream on success and failure. Add regression coverage for stream ownership, response formatting, and exception propagation.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants