Bug 49957 - Work directories of deployed webapps are deleted at shutdown
Summary: Work directories of deployed webapps are deleted at shutdown
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC All
: P2 regression (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2010-09-19 11:39 UTC by Konstantin Kolinko
Modified: 2010-10-06 18:54 UTC (History)
0 users

stacktrace (1.46 KB, text/plain)
2010-09-19 11:39 UTC, Konstantin Kolinko

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2010-09-19 11:39:18 UTC
Created attachment 26050 [details]

Observing this with the current trunk (at rev. 998656).
It does not happen with 7.0.2, so it is some recent regression.

The problem is that when I stop Tomcat all subdirectories in ${catalina.base}/work/Catalina/localhost are deleted.

Steps to reproduce:
1. Build Tomcat 7.0
2. Set JRE_HOME variable. Go to output/build/bin/ and run catalina.bat start
3. Access http://localhost:8080/examples/jsp/jsp2/el/basic-arithmetic.jsp
4. Note, that there is compiled class file in
5. Run catalina.bat stop
6. Actual behaviour: output/build/work/Catalina/localhost/ is now empty.
Expected behaviour: see step 4.

The catalina.log file has "INFO: Deploying web application directory" lines it it, but there are no logs about any webapps being undeployed.

I have run TC7 in debug mode with breakpoints in ExpandWar.delete(..) and the deletion happens in ContextConfig.destroy().

        // Changed to getWorkPath per Bugzilla 35819.
        String workDir = ((StandardContext) context).getWorkPath();
        if (workDir != null)
            ExpandWar.delete(new File(workDir));

I am attaching the full stacktrace.

The code itself looks old. I suspect that the destroy event was not passed to ContextConfig until recently.
Comment 1 Mark Thomas 2010-10-06 18:54:39 UTC
Fixed in trunk and will be in 7.0.4 onwards.