-
-
Notifications
You must be signed in to change notification settings - Fork 468
ThreadLocal Hubs should be cleaned up #2079
Copy link
Copy link
Closed
Labels
ImprovementIssue typeIssue typeThreadLocalHubProblemIssues caused by Hub being ThreadLocal and no or no easy way to clone the hubIssues caused by Hub being ThreadLocal and no or no easy way to clone the hub
Metadata
Metadata
Assignees
Labels
ImprovementIssue typeIssue typeThreadLocalHubProblemIssues caused by Hub being ThreadLocal and no or no easy way to clone the hubIssues caused by Hub being ThreadLocal and no or no easy way to clone the hub
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status
Problem Statement
At the moment Hub instances are stored in
ThreadLocalvariables. They are never cleaned up and thus cause servers like Tomcat to issue warnings as can be seen here #2074, here #420 and here #487. While there are mechanisms to clean up these leaks in Tomcat we should not rely on them and clean up instead.sentry-java/sentry/src/main/java/io/sentry/Sentry.java
Line 21 in 9f1af1c
Solution Brainstorm
We may have to move away from
ThreadLocalvariables at some point to support Webflux and similar. Until then we could try and unset theThreadLocalafter a request is done (ServletRequestListener.requestDestroyed)