Skip to content

Restore interrupt flag in ProcessRunner on InterruptedException#50451

Open
SebTardif wants to merge 1 commit into
spring-projects:mainfrom
SebTardif:fix-processrunner-interrupt-flag
Open

Restore interrupt flag in ProcessRunner on InterruptedException#50451
SebTardif wants to merge 1 commit into
spring-projects:mainfrom
SebTardif:fix-processrunner-interrupt-flag

Conversation

@SebTardif
Copy link
Copy Markdown
Contributor

ProcessRunner.waitForProcess and ReaderThread.toString catch
InterruptedException without restoring the thread interrupt flag.
This prevents callers higher up the stack from detecting the
interruption. Every other InterruptedException handler in the
codebase restores the flag; these two were the only omissions.

Add Thread.currentThread().interrupt() before re-throwing or
returning in both catch blocks. Also chain the original exception
as the cause in waitForProcess for debuggability.

Closes #50450

Signed-off-by: Sebastien Tardif sebtardif@ncf.ca

ProcessRunner.waitForProcess and ReaderThread.toString catch
InterruptedException without restoring the thread interrupt flag.
This prevents callers higher up the stack from detecting the
interruption. Every other InterruptedException handler in the
codebase restores the flag; these two were the only omissions.

Add Thread.currentThread().interrupt() before re-throwing or
returning in both catch blocks. Also chain the original exception
as the cause in waitForProcess for debuggability.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProcessRunner does not restore interrupt flag on InterruptedException

2 participants