Bug description
sentry/src/main/java/io/sentry/DirectoryProcessor.java lines 94–96 catch Throwable in the outer try-catch, which swallows InterruptedException without restoring the interrupt flag:
} catch (Throwable e) {
options.getLogger().log(SentryLevel.ERROR, "Failed to process directory.", e);
// InterruptedException reaches here — interrupt flag is cleared and never restored
}
When the enclosing thread pool calls shutdownNow(), the worker thread's interrupt is set, but processDirectory() catches and discards it. The thread continues running, the pool's awaitTermination() never unblocks, and shutdown silently hangs.
Fix
Restore the interrupt flag when the caught exception is an InterruptedException:
} catch (Throwable e) {
options.getLogger().log(SentryLevel.ERROR, "Failed to process directory.", e);
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
}
Environment
- Verified against current
main branch
Bug description
sentry/src/main/java/io/sentry/DirectoryProcessor.javalines 94–96 catchThrowablein the outer try-catch, which swallowsInterruptedExceptionwithout restoring the interrupt flag:When the enclosing thread pool calls
shutdownNow(), the worker thread's interrupt is set, butprocessDirectory()catches and discards it. The thread continues running, the pool'sawaitTermination()never unblocks, and shutdown silently hangs.Fix
Restore the interrupt flag when the caught exception is an
InterruptedException:Environment
mainbranch