users@jersey.java.net

[Jersey] Re: PermGen Memory Leak in Tomcat

From: Petr Jurák <petr.jurak_at_gmail.com>
Date: Thu, 29 Sep 2011 19:22:46 +0200

Hi,

IMHO it's not an issue of Jersey but Tomcat. We had many problems like
that (after few redeployments we need to restart Tomcat because of
PermGenSpace) in production though we don't use Jersey in these
production applications. We "solved" it with sheduled restarts in
regular service breaks. :(
Please try to search Tomcat forum for suggestion.

Br, Petr

2011/9/29 DaveCrystal <stephen.sloss_at_gmail.com>:
> Hello, I am using Jersey 1.9.1 with spring to create a rest web service
> hosted in Tomcat.
>
> The application follows the pattern in this example.
> http://blogs.oracle.com/enterprisetechtips/entry/jersey_and_spring
>
> When the web application is undeployed Tomcat logs a warning that the
> application has created a ThreadLocal and not removed it:
>
> SEVERE: The web application [/sandbox] created a ThreadLocal with key of
> type [null] (value
> [com.sun.jersey.core.impl.provider.xml.ThreadLocalSingletonContextProvider$1_at_])
> and a value of type
> [com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl] (value
> [com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl_at_f76983]) but
> failed to remove it when the web application was stopped. This is very
> likely to create a memory leak.
>
> After deploying and undeploying the app several times Tomcat runs out of
> PermGen space.
>
> Any advice on how I can cause Jersey to clean up the Thread Locals on
> undeploy would be much appreceiated.
>
> Thanks a lot.
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/PermGen-Memory-Leak-in-Tomcat-tp6843479p6843479.html
> Sent from the Jersey mailing list archive at Nabble.com.
>