Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004969 [Resin] major always 02-01-12 07:32 06-19-12 13:03
Reporter aiman_a View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.24
Summary 0004969: ServletContextListener.contextDestroyed() not called when resin is told to shutdown
Description I notice there is a bug (4331, and 4325 related) already logged and closed for this, but it was flagged as 'can not reproduce'. I can reproduce this reliably in my environment.

I have a ServletContextListener implementation that prints to StdOut, StdErr and throws an Exception in the contextDestroyed() method. I have added it as a listener in my web.xml, and the resin logs show that the context initialized message is being printed when I start the server.

The contextDestroyed() method does not get executed when I exit the server using "resin.sh shutdown".
It does however get executed when I call "resin.sh stop" and also when I dump a new war file into the web-apps directory forcing a restart.

Another interesting thing I can see is that killing the child server process (the one that the watchdog starts) manually using 'kill' calls the contextDestroyed() method. However, killing the parent watchdog process does NOT call it.

I do not have "shutdown-wait-max" defined anywhere in my resin.xml, so I assume this allows me to have 60s to perform shutdown code. I should be able to write to StdOut quite easily in that time.

I have also tested this using JVM shutdown hooks (Runtime.getRuntime().addShutdownHook) instead of contextDestroyed, and I get the exact same results.

This does not matter if you use resin.sh or pass "shutdown" as an argument directly to resin.jar
Additional Information This should behave as I have described as only "kill" should close uncleanly. This can be seen in this blog post: http://blog.caucho.com/2011/08/29/stopping-resin-stop-shutdown-or-kill/ [^]

A workaround is to simply call stop on all your servers instead of shutdown.
Attached Files

- Relationships

- Notes
(0005883)
ferg
06-19-12 13:03

server/6h10
 

- Issue History
Date Modified Username Field Change
02-01-12 07:32 aiman_a New Issue
06-19-12 13:03 ferg Note Added: 0005883
06-19-12 13:03 ferg Assigned To  => ferg
06-19-12 13:03 ferg Status new => closed
06-19-12 13:03 ferg Resolution open => fixed
06-19-12 13:03 ferg Fixed in Version  => 4.0.29


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker