deleteOnExit doesn't seem to be working for session temporary files..

2005-03-18 Thread Joseph Silverman
In our setup, we have JSP's that create a temporary file with the 
deleteOnExit flag set.
The session timeout (getMaxInactiveInterval) appears to be the 
default of 1800 seconds (30 minutes).

We are blasting our servlet container (tomcat and jetty) with JSP 
fetches (that don't handle cookies - http_load if you are curious as to 
what we are using) and noting that these files stick around till the 
servlet container itself quits (the java process goes away).  At that 
point ALL the files are deleted, and it can take HOURS in some cases to 
do so.

Is this expected behavior?  We think that these files should be deleted 
when the session expires.  That seems like the right thing to do.

Jetty appears to perform similarly except that it actually CRASHES with 
outOfMem errors after enough files are opened this way.  Tomcat seems 
more stable.

Jetty 4.2.17, Tomcat 5.0.16.
Thanks for all help.
- Joseph
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: deleteOnExit doesn't seem to be working for session temporary files..

2005-03-18 Thread Simon Kitching
On Fri, 2005-03-18 at 10:27 -0800, Joseph Silverman wrote:
 In our setup, we have JSP's that create a temporary file with the 
 deleteOnExit flag set.
 The session timeout (getMaxInactiveInterval) appears to be the 
 default of 1800 seconds (30 minutes).
 
 We are blasting our servlet container (tomcat and jetty) with JSP 
 fetches (that don't handle cookies - http_load if you are curious as to 
 what we are using) and noting that these files stick around till the 
 servlet container itself quits (the java process goes away).  At that 
 point ALL the files are deleted, and it can take HOURS in some cases to 
 do so.
 
 Is this expected behavior?  We think that these files should be deleted 
 when the session expires.  That seems like the right thing to do.

What you are seeing is what I would expect. The javadoc for
File.deleteOnExit very clearly states that the file is deleted *when the
virtual machine terminates*. 

A session is *not* a virtual machine. 

I suggest you use a SessionListener object instead; this should be
invoked when the session expires, and you can delete the files then.

Regards,

Simon


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]