even if there is a temporary network problem, I don't see why tomcat should shutdown totally? GlobalResourcesLifecycleListener: Destroying MBeans for Global JNDI Resources Stopping service Privasphere-Standalone Mar 21, 2004 9:22:02 PM org.apache.tomcat.util.net.PoolTcpEndpoint closeServerSocket SEVERE: Caught exception trying to unlock accept. java.net.SocketException: Network is unreachable at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) at java.net.Socket.connect(Socket.java:452) at java.net.Socket.connect(Socket.java:402) at java.net.Socket.connect(Socket.java:452) at java.net.Socket.connect(Socket.java:402) at java.net.Socket.<init>(Socket.java:309) at java.net.Socket.<init>(Socket.java:124) at org.apache.tomcat.util.net.PoolTcpEndpoint.closeServerSocket(PoolTcp\ Endpoint.java:326) at org.apache.tomcat.util.net.PoolTcpEndpoint.stopEndpoint(PoolTcpEndpo\ int.java:316) at org.apache.coyote.http11.Http11Protocol.destroy(Http11Protocol.java:\ 170) at org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:\ 1205) at org.apache.catalina.core.StandardService.stop(StandardService.java:5\ 46) at org.apache.catalina.core.StandardServer.stop(StandardServer.java:222\ 5) at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catali\ na.java:624) FATAL [Thread-1] (MyServlet.java:242) - Mar 21, 2004 9:22:03 PM: shutting down MyServlet? Stopping service Privasphere-Port8080 HttpConnector[8080] Stopping background thread EngineConfig: EngineConfig: Processing STOP HostConfig[www.privasphere.com]: HostConfig: Processing STOP HostConfig[www.privasphere.com]: Undeploying deployed web applications HostConfig[www.privasphere.com]: Undeploying web application at context path StandardHost[www.privasphere.com]: Removing web application at context path StandardContext[]: Stopping StandardContext[]: Stopping filters StandardContext[]: Sending application stop events StandardContext[]: Processing standard container shutdown ContextConfig[]: ContextConfig: Processing STOP StandardContext[]: Stopping complete Stopping service myApp java.lang.Exception at com.privasphere.myApp.MyServlet.destroy(MyServlet.java:235) at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java\ :1124) at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java\ :1124) at org.apache.catalina.core.StandardWrapper.stop(StandardWrapper.java:1\ 356) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.jav\ a:1036) at org.apache.catalina.startup.ContextConfig.stop(ContextConfig.java:70\ 1) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConf\ ig.java:245) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecyc\ leSupport.java:166) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3\ 676) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.jav\ a:1036) at org.apache.catalina.core.StandardHostDeployer.remove(StandardHostDep\ loyer.java:470) at org.apache.catalina.core.StandardHost.remove(StandardHost.java:852) at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:\ 758) at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:\ 758) at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:738) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.jav\ a:360) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecyc\ leSupport.java:166) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1221) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1233) at org.apache.catalina.core.StandardService.stop(StandardService.java:5\ 54) at org.apache.catalina.core.StandardServer.stop(StandardServer.java:222\ 5) at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catali\ na.java:624) Is this a regression of Bug 344 ?
This is not a regression of 344. Tomcat is stopping because something has caused the JVM to exit which in turn has called the regisitered shutdown hook. It is the running of the shutdown hook that is causing the SEVERE, not the other way around. Since tomcat is shutting down in response to a request to do exactly that I am closing this bug as invalid.
Sure, the exception came from the JVM, but why do you claim that the JVM is shutting down due to this? To me, it rather appears that the tomcat code neither bothers to i) catch and analyze java.net.SocketException which may well be of very temporary nature nor ii) provides a useful log-output that helps an admin to fix the issue without having to fully restart tomcat. it appears that unlockAccept() in PoolTcpEndpoint.java isn't prepared to do anything smart when a SocketException comes along - or am I wrong?
I think you are wrong. Let me try to explain. In your initial report you quote two stack straces. Both of these start at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run This is a shutdown hook that is registered with the JVM at tomcat startup. When JVM shuts down (System.exit(), CTRL-C on windows, catalina stop etc) this shutdown hook is executed. The exceptions you are seeing are as a result of this shutdown code. My point is that something is causing the JVM to shutdown. As part of the shutdown process the JVM calls the shutdown hook. During the running of the shutdown hook some exceptions occur and this is what you are seeing. The hard part here is trying to work out what is causing the JVM to exit in the first place. I have previously checked every call in the tomcat code to System.exit() and they are all preceeded by a log message. On this basis I think you can rule out any tomcat code. Is there a System.exit() in one of your webapps? Something that might be worth trying is running under a security manager that would thow a security exception if a webapp tried something like this. It is also possible that the OS is signalling the JVM to shutdown. Tracking this down could be trickier. If you wish to discuss this further please use the tomcat-user mailing list as it is more appropriate to this type of discussion.
*** Bug 27141 has been marked as a duplicate of this bug. ***