You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jo...@wellsfargo.com.INVALID on 2022/02/09 18:31:57 UTC

RE: clearReferencesThreads issues warning about 2 threads, spawned by JDK in printing components

Thanks Mark,

Unfortunately the URL in the error gets blocked by our security, so I looked it up on my home system now.



Dream * Excel * Explore * Inspire
Jon McAlexander
Infrastructure Engineer
Asst Vice President

Middleware Product Engineering
Enterprise CIO | EAS | Middleware | Infrastructure Solutions

8080 Cobblestone Rd | Urbandale, IA 50322
MAC: F4469-010
Tel 515-988-2508 | Cell 515-988-2508

jonmcalexander@wellsfargo.com
This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.


> -----Original Message-----
> From: Mark Thomas <ma...@apache.org>
> Sent: Monday, August 23, 2021 3:06 AM
> To: users@tomcat.apache.org
> Subject: Re: clearReferencesThreads issues warning about 2 threads,
> spawned by JDK in printing components
> 
> On 23/08/2021 08:10, Thomas Hoffmann (Speed4Trade GmbH) wrote:
> 
> <snip/>
> 
> > Is there anything, the application can prevent this?
> 
> Yes. Call Thread.setContextClassLoader(ClassLoader) before calling the code
> that creates those threads, passing the common class loader.
> Afterwards, reset the TCCL back to the web application class loader.
> 
> > Should Tomcat maybe skip the warning if the thread is demonized?
> 
> No. The threads have the web app class loader as their TCCL so you have a
> potential memory leak. The warning is correct.
> 
> > Or maybe these threads should be ignored when checking for orphaned
> threads?
> 
> No, for the same reason.
> 
> > It was tested with Tomcat 9.0.52, Windows 10, Coretto-JDK 11.0.12_7.
> 
> You might want to consider raising a bug against the JDK. It could be argued
> that those threads should be created with a specific class loader to avoid
> memory leaks in container environments.
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org