You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Gary Johnson <ga...@rhoworld.com> on 2011/09/14 20:48:33 UTC
Shutting Down Tomcat Fails With Memory Leak When Started Via CXFNonSpringJaxrsServlet
Hello All,
I'm developing a RESTful web service using CXFNonSpringJaxrsServlet and
a user.model defined in web.xml.
All development so far has been within eclipse and going well, except
when it comes time to shutdown Tomcat.
When the [Stop Server] button is pressed in the Servers view the
messages in the Tomcat Console (see below)
are display followed by a Terminate Server popup with the message:
Server Apache Tomcatv7.0.20 at localhost is not
responding.
Do you want to Terminate this server? [OK] [Cancel]
Pressing [OK] stops Tomcat. After looking at the
CXFNonSpringJaxrsServlet.init(...) code, the last thing it does
is call JAXRSServerFactoryBean bean.create(). It appears there needs to
be a way to save the Server from the
bean.create() so bean.stop() or bean.destroy() can be called in the
CXFNonSpringJaxrsServlet destroy() method.
I tried extending CXFNonSpringJaxrsServlet and override the destroy()
method, but could not find a way to
access the bean created in init(). Would someone tell me how this can be
done or is there a totally
different way to shutdown the server?...Thanks, Gary
________________________________
***** Tomcat Console Excerpt *****
Sep 12, 2011 8:11:37 PM org.apache.catalina.core.StandardService
stopInternal
INFO: Stopping service Catalina
Sep 12, 2011 8:11:37 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/RhoRandWebServices] appears to have
started a thread named
[qtp26625789-12 Acceptor0 SelectChannelConnector@localhost:9080
STARTING]
but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2011 8:11:37 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/RhoRandWebServices] appears to have
started a thread named
[qtp26625789-13 Selector0 SelectChannelConnector@localhost:9080 STARTED]
but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2011 8:11:37 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/RhoRandWebServices] appears to have
started a thread named
[qtp26625789-14] but has failed to stop it. This is very likely to
create a memory leak.
... plus about 10 more identical to this last message, but with
different [qtp...] thread names.
________________________________
This is similar to
http://cxf.547215.n5.nabble.com/Threads-warnings-while-undeploying-web-a
pplication-td3289034.html.
Re: Shutting Down Tomcat Fails With Memory Leak When Started Via CXFNonSpringJaxrsServlet
Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday, September 14, 2011 12:46:54 PM gjohnson wrote:
> This worked perfectly. Thank you very much...Gary
Thanks for the update. I logged an issue and am running tests on a patch:
https://issues.apache.org/jira/browse/CXF-3803
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com
Re: Shutting Down Tomcat Fails With Memory Leak When Started Via
CXFNonSpringJaxrsServlet
Posted by gjohnson <ga...@rhoworld.com>.
This worked perfectly. Thank you very much...Gary
--
View this message in context: http://cxf.547215.n5.nabble.com/Shutting-Down-Tomcat-Fails-With-Memory-Leak-When-Started-Via-CXFNonSpringJaxrsServlet-tp4803961p4804180.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Shutting Down Tomcat Fails With Memory Leak When Started Via CXFNonSpringJaxrsServlet
Posted by Daniel Kulp <dk...@apache.org>.
Can you try adding a destroy method to your subclass that does:
public void destroy() {
super.destroy();
getBus().shutdown(true);
}
and seeing if that helps?
I'm not seeing a Bus shutdown at all in the non-spring servlet cases and that
does seem to be a concern. In theory, that should release a bunch of things
that may be locking things. If that works, definitely submit a bug/patch.
Dan
On Wednesday, September 14, 2011 2:48:33 PM Gary Johnson wrote:
> Hello All,
>
> I'm developing a RESTful web service using CXFNonSpringJaxrsServlet and
> a user.model defined in web.xml.
> All development so far has been within eclipse and going well, except
> when it comes time to shutdown Tomcat.
> When the [Stop Server] button is pressed in the Servers view the
> messages in the Tomcat Console (see below)
> are display followed by a Terminate Server popup with the message:
>
> Server Apache Tomcatv7.0.20 at localhost is not
> responding.
> Do you want to Terminate this server? [OK] [Cancel]
>
> Pressing [OK] stops Tomcat. After looking at the
> CXFNonSpringJaxrsServlet.init(...) code, the last thing it does
> is call JAXRSServerFactoryBean bean.create(). It appears there needs to
> be a way to save the Server from the
> bean.create() so bean.stop() or bean.destroy() can be called in the
> CXFNonSpringJaxrsServlet destroy() method.
>
> I tried extending CXFNonSpringJaxrsServlet and override the destroy()
> method, but could not find a way to
> access the bean created in init(). Would someone tell me how this can be
> done or is there a totally
> different way to shutdown the server?...Thanks, Gary
> ________________________________
>
> ***** Tomcat Console Excerpt *****
>
> Sep 12, 2011 8:11:37 PM org.apache.catalina.core.StandardService
> stopInternal
> INFO: Stopping service Catalina
>
> Sep 12, 2011 8:11:37 PM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/RhoRandWebServices] appears to have
> started a thread named
> [qtp26625789-12 Acceptor0 SelectChannelConnector@localhost:9080
> STARTING]
> but has failed to stop it. This is very likely to create a memory leak.
>
> Sep 12, 2011 8:11:37 PM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/RhoRandWebServices] appears to have
> started a thread named
> [qtp26625789-13 Selector0 SelectChannelConnector@localhost:9080 STARTED]
> but has failed to stop it. This is very likely to create a memory leak.
>
> Sep 12, 2011 8:11:37 PM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/RhoRandWebServices] appears to have
> started a thread named
> [qtp26625789-14] but has failed to stop it. This is very likely to
> create a memory leak.
>
> ... plus about 10 more identical to this last message, but with
> different [qtp...] thread names.
> ________________________________
>
> This is similar to
> http://cxf.547215.n5.nabble.com/Threads-warnings-while-undeploying-web-a
> pplication-td3289034.html.
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com