Skip to content

Docker Compose support does not restore thread interrupt flag when catching InterruptedException#50451

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

Docker Compose support does not restore thread interrupt flag when catching 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
@wilkinsona wilkinsona changed the title Restore interrupt flag in ProcessRunner on InterruptedException Docker Compose support does not restore thread interrupt flag when catching InterruptedException May 16, 2026
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels May 16, 2026
@wilkinsona wilkinsona added this to the 3.5.x milestone May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProcessRunner does not restore interrupt flag on InterruptedException

3 participants