You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Pavel Arnošt <pa...@loutka.cz> on 2012/07/12 21:26:27 UTC

Memory leak?

Hi,

I have very simple setup of Tomcat 7.0.29 and MyFaces 2.1.8 and when I
reload application, I see:

VII 12, 2012 9:21:49 ODP. org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/evidence] created a ThreadLocal with key
of type [java.lang.ThreadLocal] (value
[java.lang.ThreadLocal@1529c06]) and a value of type
[org.apache.myfaces.context.servlet.ServletExternalContextImpl] (value
[org.apache.myfaces.context.servlet.ServletExternalContextImpl@fd6c78])
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.

Message is repeated several times. The more I use the JSF application,
the more messages I see.

Is there a way how can I fix it?

Thanks,
Regards
Pavel

Re: Memory leak?

Posted by Pavel Arnošt <pa...@loutka.cz>.
Thanks, I think I found it in:

FacesContextImpl.release():

        _facesContextFactory = null;
        _renderKitFactory = null;
        _partialViewContextFactory = null;

        if (_facesContextFactory != null)
        {
            _facesContextFactory.release();
            _facesContextFactory = null;
        }

(_facesContextFactory is set to null and then tested for null).

I filed a bug report at https://issues.apache.org/jira/browse/MYFACES-3585.

Regards,
Pavel

2012/7/13 Rohit Kelapure <ke...@gmail.com>:
> The way to fix this is to find out what MyFaces code is putting the
> ServletExternalContextImpl on the Threadlocal and
> not cleaning it up after the request ends.
>
> -cheers,
> ROhit
>
> On Thu, Jul 12, 2012 at 3:26 PM, Pavel Arnošt <pa...@loutka.cz> wrote:
>> Hi,
>>
>> I have very simple setup of Tomcat 7.0.29 and MyFaces 2.1.8 and when I
>> reload application, I see:
>>
>> VII 12, 2012 9:21:49 ODP. org.apache.catalina.loader.WebappClassLoader
>> checkThreadLocalMapForLeaks
>> SEVERE: The web application [/evidence] created a ThreadLocal with key
>> of type [java.lang.ThreadLocal] (value
>> [java.lang.ThreadLocal@1529c06]) and a value of type
>> [org.apache.myfaces.context.servlet.ServletExternalContextImpl] (value
>> [org.apache.myfaces.context.servlet.ServletExternalContextImpl@fd6c78])
>> 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.
>>
>> Message is repeated several times. The more I use the JSF application,
>> the more messages I see.
>>
>> Is there a way how can I fix it?
>>
>> Thanks,
>> Regards
>> Pavel

Re: Memory leak?

Posted by Rohit Kelapure <ke...@gmail.com>.
The way to fix this is to find out what MyFaces code is putting the
ServletExternalContextImpl on the Threadlocal and
not cleaning it up after the request ends.

-cheers,
ROhit

On Thu, Jul 12, 2012 at 3:26 PM, Pavel Arnošt <pa...@loutka.cz> wrote:
> Hi,
>
> I have very simple setup of Tomcat 7.0.29 and MyFaces 2.1.8 and when I
> reload application, I see:
>
> VII 12, 2012 9:21:49 ODP. org.apache.catalina.loader.WebappClassLoader
> checkThreadLocalMapForLeaks
> SEVERE: The web application [/evidence] created a ThreadLocal with key
> of type [java.lang.ThreadLocal] (value
> [java.lang.ThreadLocal@1529c06]) and a value of type
> [org.apache.myfaces.context.servlet.ServletExternalContextImpl] (value
> [org.apache.myfaces.context.servlet.ServletExternalContextImpl@fd6c78])
> 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.
>
> Message is repeated several times. The more I use the JSF application,
> the more messages I see.
>
> Is there a way how can I fix it?
>
> Thanks,
> Regards
> Pavel

Re: Memory leak?

Posted by Pavel Arnošt <pa...@loutka.cz>.
Hi,

I did, but I didn't find anything about ThreadLocal and
ServletExternalContextImpl.

Tomcat's memory leak protection is described at
http://wiki.apache.org/tomcat/MemoryLeakProtection and code is at
http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
(method checkThreadLocalMapForLeaks), but it's quite advanced stuff
for me.

2012/7/12 Milo van der Zee <mi...@vanderzee.org>:
> Hello,
>
> I always have the same and I can't say I see any memory leak anymore.
> Even after weeks of intensive running the memory does not increase.
>
> I vaguely remember that it is no issue. Did you search StackExchange?
>
> MAG,
> Milo
>
>
> On Thu, 2012-07-12 at 21:26 +0200, Pavel Arnošt wrote:
>> Hi,
>>
>> I have very simple setup of Tomcat 7.0.29 and MyFaces 2.1.8 and when I
>> reload application, I see:
>>
>> VII 12, 2012 9:21:49 ODP. org.apache.catalina.loader.WebappClassLoader
>> checkThreadLocalMapForLeaks
>> SEVERE: The web application [/evidence] created a ThreadLocal with key
>> of type [java.lang.ThreadLocal] (value
>> [java.lang.ThreadLocal@1529c06]) and a value of type
>> [org.apache.myfaces.context.servlet.ServletExternalContextImpl] (value
>> [org.apache.myfaces.context.servlet.ServletExternalContextImpl@fd6c78])
>> 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.
>>
>> Message is repeated several times. The more I use the JSF application,
>> the more messages I see.
>>
>> Is there a way how can I fix it?
>>
>> Thanks,
>> Regards
>> Pavel
>
>

Re: Memory leak?

Posted by Milo van der Zee <mi...@vanderzee.org>.
Hello,

I always have the same and I can't say I see any memory leak anymore.
Even after weeks of intensive running the memory does not increase.

I vaguely remember that it is no issue. Did you search StackExchange?

MAG,
Milo


On Thu, 2012-07-12 at 21:26 +0200, Pavel Arnošt wrote:
> Hi,
> 
> I have very simple setup of Tomcat 7.0.29 and MyFaces 2.1.8 and when I
> reload application, I see:
> 
> VII 12, 2012 9:21:49 ODP. org.apache.catalina.loader.WebappClassLoader
> checkThreadLocalMapForLeaks
> SEVERE: The web application [/evidence] created a ThreadLocal with key
> of type [java.lang.ThreadLocal] (value
> [java.lang.ThreadLocal@1529c06]) and a value of type
> [org.apache.myfaces.context.servlet.ServletExternalContextImpl] (value
> [org.apache.myfaces.context.servlet.ServletExternalContextImpl@fd6c78])
> 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.
> 
> Message is repeated several times. The more I use the JSF application,
> the more messages I see.
> 
> Is there a way how can I fix it?
> 
> Thanks,
> Regards
> Pavel