HDDS-14830. Handle interrupt gracefully in XceiverClientGrpc.sendCommandWithRetry#10178
Open
chihsuan wants to merge 1 commit intoapache:masterfrom
Open
HDDS-14830. Handle interrupt gracefully in XceiverClientGrpc.sendCommandWithRetry#10178chihsuan wants to merge 1 commit intoapache:masterfrom
chihsuan wants to merge 1 commit intoapache:masterfrom
Conversation
Gargi-jais11
reviewed
May 5, 2026
Contributor
Gargi-jais11
left a comment
There was a problem hiding this comment.
Thanks @chihsuan for working on this. LGTM!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
XceiverClientGrpc.sendCommandWithRetryretries a request across the pipeline's datanodes and rethrows the last capturedioExceptionafter the loop. Thecatch (InterruptedException)branch logged the error and restored the interrupt flag, but did not assignioExceptionor exit the loop. With the flag restored, each subsequentFuture.get()throwsInterruptedExceptionimmediately, so the loop falls through every datanode and exits withioException == null. The post-loopObjects.requireNonNull(ioException, ...)then throwsNullPointerException, masking the real interrupt — which is what the EC reconstruction worker pool sees during datanode shutdown.The fix throws
InterruptedIOException(with the originalInterruptedExceptionas cause) directly from the catch block. This matches the existing convention already used inXceiverClientGrpc.sendCommand(lines 396-411) andXceiverClientSpi.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14830
How was this patch tested?
New unit test
TestXceiverClientGrpc#testInterruptedCommandThrowsInterruptedIOExceptionreproduces the original NPE deterministically (pre-sets the test thread's interrupt flag and stubssendCommandAsyncto return a never-completing future) and asserts:InterruptedIOExceptionis thrown — the regression that this PR fixes (wasNullPointerException).InterruptedException— debugging info preserved.Thread.currentThread().isInterrupted()is still true — callers can still detect the interrupt.The flag is cleared in
finallybeforeclient.close()runs, so channel shutdown is not affected by the test setup.The test fails on master without the production-code change in this PR, confirming it exercises the actual bug path:
Local checks:
mvn checkstyle:check -pl hadoop-hdds/client,hadoop-ozone/integration-test→ 0 violations.Full CI: Runs via the
build-branchworkflow on the fork. https://github.com/chihsuan/ozone/actions/runs/25251708235