-
-
Notifications
You must be signed in to change notification settings - Fork 467
Closed
Labels
BugIssue typeIssue type
Description
Integration
sentry
Java Version
19
Version
7.16.0
Steps to Reproduce
- Configure your DSN with a low limit, 1.
- Run a script that triggers many
uncaughtExceptionand observe how slow the handling gets. This line in the console can confirm slowdown:Timed out waiting to flush event to disk before crashing. Event: %s
Simple script:
public class SentryTest {
public static void main(String[] args) throws InterruptedException {
Sentry.init(options -> {
options.setDsn("XYZ");
options.setEnvironment("XYZ");
options.setDebug(true);
});
for(int i = 0; i < 100; i++) {
System.out.println("Iteration: " + i);
Thread workerThread = new Thread(() -> {
Thread thread = Thread.currentThread();
thread.getUncaughtExceptionHandler().uncaughtException(thread, new Exception("This is a test exception"));
});
long startTime = System.nanoTime();
workerThread.start();
workerThread.join();
long durationInMillis = (System.nanoTime() - startTime) / 1_000_000;
if (durationInMillis > 1000) {
throw new IllegalStateException("Sentry blocked the thread");
}
}
}
}
Expected Result
Don't block the thread, which could potentially slow down different parts of the user app.
Most probably, the latch used by BlockingFlushHint should be properly released in RateLimiter like you already do for other hints (markHintWhenSendingFailed)
Actual Result
The thread blocks for 15 seconds, blocking other parts of the user application.
The workaround could be to reduce flushTimeoutMillis.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugIssue typeIssue type
Projects
Status
No status