-
-
Couldn't load subscription status.
- Fork 460
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
Description
Problem Statement
At the moment Hub instances are stored in ThreadLocal variables. 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.
| private static final @NotNull ThreadLocal<IHub> currentHub = new ThreadLocal<>(); |
Solution Brainstorm
We may have to move away from ThreadLocal variables at some point to support Webflux and similar. Until then we could try and unset the ThreadLocal after a request is done (ServletRequestListener.requestDestroyed)
bruno-garcia
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
Projects
Status
No status