Integration
sentry
Java Version
17
Version
7.6.0
Steps to Reproduce
Cannot be very specific because sentry SDK is being used by a plugin within a framework, and within that environment we cannot reproduce the issue unless we are receiving production traffic
Expected Result
no memory leak
Actual Result
the UncaughtExceptionHandlerIntegration appears to occupy the majority of the heap, eventually resulting in memory exhaustion and a crash.
On auditing the code it appears that
|
final Thread.UncaughtExceptionHandler currentHandler = |
|
threadAdapter.getDefaultUncaughtExceptionHandler(); |
|
if (currentHandler != null) { |
|
this.options |
|
.getLogger() |
|
.log( |
|
SentryLevel.DEBUG, |
|
"default UncaughtExceptionHandler class='" |
|
+ currentHandler.getClass().getName() |
|
+ "'"); |
|
defaultExceptionHandler = currentHandler; |
|
} |
|
|
|
threadAdapter.setDefaultUncaughtExceptionHandler(this); |
causes a stack to form, which prevents any of the exeption handlers from being GC'd and results in OOM. No idea why that register method is being called over and over again

we are planning to simply turn the UncaughtExceptionHandler off in the options to resolve this issue, but it's weird that the Sentry SDK apparently behaves this way by default
Integration
sentry
Java Version
17
Version
7.6.0
Steps to Reproduce
Cannot be very specific because sentry SDK is being used by a plugin within a framework, and within that environment we cannot reproduce the issue unless we are receiving production traffic
Expected Result
no memory leak
Actual Result
the UncaughtExceptionHandlerIntegration appears to occupy the majority of the heap, eventually resulting in memory exhaustion and a crash.
On auditing the code it appears that
sentry-java/sentry/src/main/java/io/sentry/UncaughtExceptionHandlerIntegration.java
Lines 68 to 81 in 28c9a83
causes a stack to form, which prevents any of the exeption handlers from being GC'd and results in OOM. No idea why that register method is being called over and over again
we are planning to simply turn the UncaughtExceptionHandler off in the options to resolve this issue, but it's weird that the Sentry SDK apparently behaves this way by default