[ 
https://issues.apache.org/jira/browse/CAMEL-17588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504196#comment-17504196
 ] 

Claus Ibsen commented on CAMEL-17588:
-------------------------------------

The sample would help to investigate if there is some "clever hacks" - there 
are some using reflection to go inside JDK ThreadLocal but then you clear 
everytyhing and not only Camel. But you could maybe find out if the values 
inside ThreaadLocal impl are from Camel and not, and then only clear Camel.

However I think its a dirty hack and the JDK documentation mentions that the 
JVM will automatic clear when classes are unloaded.

And Tomcat is the only JEE server, that I have seen, that logs these WARNS on 
undeploying apps.

> Missing Clean-Up for DefaultReactiveExecutor.Worker-ThreadLocals
> ----------------------------------------------------------------
>
>                 Key: CAMEL-17588
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17588
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.14.1
>            Reporter: Björn Ohm
>            Priority: Minor
>             Fix For: 3.11.6, 3.14.2, 3.17.0
>
>         Attachments: catalina.out
>
>
> We are running a Camel-Application on a Tomcat. While the Tomcat-Shutdown we 
> observed a bunch of Thread-Local-WARNINGS in the catalina.out like:
> {code:java}
> 02-Feb-2022 01:31:23.810 SCHWERWIEGEND [main] 
> org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks 
> The web application [provinzial-integration-intern] created a ThreadLocal 
> with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value 
> [java.lang.ThreadLocal$SuppliedThreadLocal@4a4357f5]) and a value of type 
> [org.apache.camel.impl.engine.DefaultReactiveExecutor.Worker] (value 
> [org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker@76e66f23]) but 
> failed to remove it when the web application was stopped. Threads are going 
> to be renewed over time to try and avoid a probable memory leak.{code}
> Obviously this belongs to the ThreadLocals used in 
> {_}org.apache.camel.impl.engine.DefaultReactiveExecutor{_}.
> In the worst case, this can lead to memory problems. 
> The ThreadLocals should be cleaned up.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to