tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Memory Leakage Problem in Tomcat 7.0.94
Date Fri, 11 Oct 2019 14:20:33 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Ankit,

On 10/11/19 00:52, ankitr.desai@spec-india.com wrote:
>> 1. Allow Tomcat to clear these references, and otherwise ignore
>> the error messages>
> Can you please let us know how to Allow Tomcat to clear these>
> references?
Have another look at the log message:

>> SEVERE: The web application [/TLSAdmin] created a ThreadLocal
>> with key of type [java.lang.ThreadLocal] (value
>> [java.lang.ThreadLocal@794fa987]) and a value of type
>> [flex.messaging.config.SystemSettings] (value
>> [flex.messaging.config.SystemSettings@7dca495e]) 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.

Tomcat is already protecting the heap by clearing these ThreadLocal
references for you. It may take some time, and your application won't
cleanly undeploy until all the threads have been "renewed".

- -chris

> -----Original Message----- From: Christopher Schultz
> <chris@christopherschultz.net> Sent: 10 October 2019 11:08 PM To:
> users@tomcat.apache.org Subject: Re: Memory Leakage Problem in
> Tomcat 7.0.94
>
> Ankit,
>
> On 10/10/19 10:17, ankitr.desai@spec-india.com wrote:
>> We are using Tomcat 7.0.94 version and we have facing memory
>> leakage issue when tomcat server is going to shutdown.
>
>> Please help in this case, how to solve these kind of logs?
>
>> Please find below sample logs from catalina.log file and code.
>
>
>
>> Oct 10, 2019 6:35:36 PM
>> org.apache.catalina.loader.WebappClassLoaderBase
>> clearReferencesThreads
>
>> SEVERE: The web application [/TLSAdmin] appears to have started a
>>  thread named [Timer-0] but has failed to stop it. This is very
>> likely to create a memory leak.
>
> Your application started this thread and hasn't stopped it. (See
> below)
>
>> Oct 10, 2019 6:35:36 PM
>> org.apache.catalina.loader.WebappClassLoaderBase
>> clearReferencesThreads
>
>> SEVERE: The web application [/TLSAdmin] appears to have started a
>>  thread named [schedulerFactory_Worker-1] but has failed to stop
>> it. This is very likely to create a memory leak.
>
> Same here, except it's likely to be a thread pool with a number of
> threads with similar names.
>
> To fix the thread issues, you need to find the place in your code
> where the threads are started (or the threadpool is created) and
> make sure that you have access to that thread (or pool) during
> application shutdown. Storing stuff like this in the application
> (context) scope is one way to do it.
>
> I would recommend another ServletContextListener that locates those
> threads (pools) and stops them. Remember that Thread.stop() doesn't
> really work. Instead, you have to let the thread know that it's
> time to stop itself.
>
> Threads called "Timer-X" are usually simple threads created by
> java.util.TimerTask and friends, and you should be able to store a
> reference to the task and stop it on app shutdown.
>
>> [snip]
>
>> Oct 10, 2019 6:35:36 PM
>> org.apache.catalina.loader.WebappClassLoaderBase
>> checkThreadLocalMapForLeaks
>
>> SEVERE: The web application [/TLSAdmin] created a ThreadLocal
>> with key of type [java.lang.ThreadLocal] (value
>> [java.lang.ThreadLocal@794fa987]) and a value of type
>> [flex.messaging.config.SystemSettings] (value
>> [flex.messaging.config.SystemSettings@7dca495e]) 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.
>
> Something in "flex" has put an object in ThreadLocal storage and
> never removed it. This is harder to fix than the threading stuff
> because you each thread needs to purge the ThreadLocal objects in
> order to "clean" the system.
>
> You have two options, really:
>
> 1. Allow Tomcat to clear these references, and otherwise ignore the
> error messages.
>
> 2. Change your application so that at the end of each request you
> remove these ThreadLocal values from the request-processing
> thread.
>
> Hope that helps, -chris
>
> ---------------------------------------------------------------------
>
>
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl2gj7EACgkQHPApP6U8
pFhDmQ/9GAOJC1DyXiJQ8vMYi6l9s+DfuMFyCDJniuF+AqcHJ9e0k+2aDtETqR/z
xGyAoia3nFrLwRXdQAPRqfZDyLAJijWb4WxlWl3P0QxPV/l1nNJgco6j1no8vzNL
14azDixoWANDHd4wx6eu0y0+/pTr+PgEl/CSa3RBvEMvu3zDPfU5mV5ebaYuXDMH
e5n+f3/7VQAvxpIPnGQNC6AUtBv+65pUpL4M4e/QRrey1p2tTJPl2vBq3ViIBs4l
mufkv9FW4YhgovFXMCZmpAWl1VrOTnTBcQ5xL5LTk3Nynh1uiREdf0HxusJLD4Xa
3VRpDlP6CeOCZm4lkwWQQmTd2eBaKDKx0pQe9M3Hn9WLHnHaMM0UgzXAvNJptzUk
vudzUPM4sBh6BncKyBMO9G+Yae6zQZ7XQEfyX+ITkPiX0bk2xeHGHiBO7J0VGHsP
dE9JnGWyAoRR132ZyevzPmxarEQeiwway0uLT1v/J5zee+ViPWSM/mutSFSJ6qqB
OmJnEeepBVqRxFc8IoYE6FCUQ5BdkDi+EkFQ1zSyLALDDdXkVeaKp4snH3lftX8H
aLMpOETXk293vidg0LDscQD5UUoRnrOafVJnhUa1quFXM8vP8JjxjGL61BTuTc8n
uEK1IAZjdn3sqhzteMbvzziwMlaWbsEaU5G/ei5CklwAiV3R5BA=
=+eJ4
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message