You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/11/25 04:55:13 UTC

DO NOT REPLY [Bug 24961] New: - Temporary files marked "deleteOnExit" not deleted when Tomcat runs as NT Service

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24961>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24961

Temporary files marked "deleteOnExit" not deleted when Tomcat runs as NT Service

           Summary: Temporary files marked "deleteOnExit" not deleted when
                    Tomcat runs as NT Service
           Product: Tomcat 4
           Version: 4.1.29
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: cstaylor@nanshu.com


I've written a simple JSP to illustrate:

<%@ page contentType="text/html;charset=UTF-8" session="false" 
import="java.io.*"%>
<% 
	ServletContext servlet_ctxt = getServletContext();
	File temp_directory = (File)servlet_ctxt.getAttribute
( "javax.servlet.context.tempdir" );
	File new_temp_file = File.createTempFile ( "test", "file", 
temp_directory );
	new_temp_file.deleteOnExit();
%>

Just make this available to Tomcat, run Tomcat as a console app, and when you 
CTRL-C to quit Tomcat, those files will disappear.

However, do the exact same thing using Tomcat as a service, and when you "net 
stop Apache Tomcat 4.1", those files will still exist.

I've found a workaround for my particular use of temp files, but I think that 
it would be best if this was fixed.  I believe the issue relates to how 
tomcat.exe is killing the Java process, but I'm not entirely sure.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org