Skip to content

Fix/sender stalls jvm shutdown - #207

Merged
RomanDavlyatshin merged 5 commits into
mainfrom
fix/sender-stalls-jvm-shutdown
Jun 18, 2026
Merged

RomanDavlyatshin merged 5 commits into
mainfrom
fix/sender-stalls-jvm-shutdown

Conversation

@RomanDavlyatshin

Copy link
Copy Markdown
Member

No description provided.

@RomanDavlyatshin
RomanDavlyatshin requested a review from iryabov June 3, 2026 09:11
if (!scheduledThreadPool.awaitTermination(1, TimeUnit.SECONDS)) {
logger.error("Failed to send some tests prior to shutdown")
scheduledThreadPool.shutdownNow();
if (remainingMs > 0 && !scheduledThreadPool.awaitTermination(remainingMs, TimeUnit.MILLISECONDS)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we wait for the full remainingMs instead of a shorter timeout specific to this step?
If we block here for the entire remaining shutdown window due to a stuck task, other cleanup steps may not run in time.

logger.error("Failed to send some tests prior to shutdown")
scheduledThreadPool.shutdownNow();
if (remainingMs > 0 && !scheduledThreadPool.awaitTermination(remainingMs, TimeUnit.MILLISECONDS)) {
logger.warn { "Test sending scheduler did not stop within ${remainingMs}ms; leaving it for JVM exit." }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is shutdownNow() not used here?
Without it, non-daemon threads may remain running in a worst-case scenario, potentially preventing the JVM from shutting down.

@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@RomanDavlyatshin
RomanDavlyatshin merged commit 488a044 into main Jun 18, 2026
17 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants