Skip to content

Fix/sender stalls jvm shutdown#207

Open
RomanDavlyatshin wants to merge 4 commits into
mainfrom
fix/sender-stalls-jvm-shutdown
Open

Fix/sender stalls jvm shutdown#207
RomanDavlyatshin wants to merge 4 commits into
mainfrom
fix/sender-stalls-jvm-shutdown

Conversation

@RomanDavlyatshin
Copy link
Copy Markdown
Member

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

@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.

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