Bug 49530 - Context is not correctly stopped at shutdown
Summary: Context is not correctly stopped at shutdown
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.0
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
: 49846 (view as bug list)
Depends on:
Reported: 2010-06-30 10:08 UTC by Rainer Frey
Modified: 2010-08-30 08:38 UTC (History)
1 user (show)

Application that show the behavior (2.37 KB, application/x-webarchive)
2010-06-30 10:08 UTC, Rainer Frey
Source code of the test servlet (806 bytes, text/x-java)
2010-06-30 10:10 UTC, Rainer Frey
Log file with LifecycleBase logger on FINE level (118.24 KB, text/x-log)
2010-06-30 10:12 UTC, Rainer Frey

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Frey 2010-06-30 10:08:43 UTC
Created attachment 25669 [details]
Application that show the behavior

Apparently a web application context is not correctly stopped when shutting down Tomcat 7.0.0. I noticed that the destroy() method of a Servlet that's loaded on startup was not called, and put together a test case (see attached files). 

The test servlet writes to System.out on init() and destroy(), the output on init appears in logs/catalina.out, but no output on destroy. From what I  understand of the attached log, the context isn't stopped at all.

Steps to reproduce:
1. copy attached startupServlet.war to webapps
2. start Tomcat, then "StartTestServlet.init" appears in catalina.out
3. stop Tomcat

Actual Result:
no output appears in logs/catalina.out

Expected Result:
"StartTestServlet.destroy" appears in catalina.out
catalina.log shows evidence of context /startupServlet being stopped

java -version:
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

uname -a
Linux <hostname> 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 19:31:57 UTC 2010 x86_64 GNU/Linux
Comment 1 Rainer Frey 2010-06-30 10:10:24 UTC
Created attachment 25670 [details]
Source code of the test servlet
Comment 2 Rainer Frey 2010-06-30 10:12:25 UTC
Created attachment 25671 [details]
Log file with LifecycleBase logger on FINE level
Comment 3 Mark Thomas 2010-07-02 14:05:51 UTC
Thanks for the report and test case.

This has been fixed in trunk and will be included in 7.0.1 onwards.
Comment 4 Mark Thomas 2010-08-30 08:38:19 UTC
*** Bug 49846 has been marked as a duplicate of this bug. ***