On Fri, May 4, 2012 at 12:47 AM, Jamie Maher <[email protected]> wrote:
> > > On 5/2/2012 9:56 AM, Denis Gervalle wrote: > > On Wed, May 2, 2012 at 3:13 PM, Vincent Massol <[email protected]> > wrote: > > > >> On Apr 23, 2012, at 3:43 PM, Caleb James DeLisle wrote: > >> > >>> Hi, > >>> > >>> In order to fix XWIKI-7748 and XWIKI-7749, we need a plan for deleting > >> temporary file. > >>> XWikiAttachmentContent uses File.deleteOnExit(), but in Sun's > >> implementation, deleteOnExit() > >>> only deletes on a *clean* exit, in a crash it can't delete the files > but > >> it doesn't tag them > >>> so they can be deleted in the next run either. Since temp files are > >> usually pseudo-randomly > >>> named, they are impossible to find and delete later. > >>> > >>> I propose that we create a subdirectory, `java.io.tmpdir`/xwiki/ which > >> will be removed on > >>> application exit. If the jvm crashes, the files will be removed next > >> time around. Then alter > >>> ApplicationContext.getTemporaryDirectory() to yield this directory. > >> Sounds ok even though I don't like that we do extra work. Isn't there > some > >> lib out there that do this? Doesn't commons-io do this? > >> > > I do not really agree, this does not fix the most common issue which is > the > > growing size of the temporary folder for a long running server. We need a > > way to limit the temporary folder size, and the best would be to find > some > > existing implementation of such behavior. > Hi Denis, is this a problem in your setup? I'm just in the process of > I was just reacting to the above thread that refer XWIKI-7749, isn't this issue confirmed ? > rolling out a 3.5 version and I thought that this was a problem with > some image attachment heavy gallery pages and so I reported it as > XWIKI-7750. > > The issue was closed with a comment that the finalize() method of > DiskFileItem cleans up those temp files in the finalizer thread and > deletes the file once the DiskFileItem is garbage collected. > > What happens in your setup, do your temp files just add up? I noticed > cached XWikiAttachments don't release their files because they're still > referencing the DiskFileItem. > > > > > > >> java.io.tmpdir is for standard environment and not for servlet > environment > >> so we need to use the proper tmpdir depending on the environment module. > >> Ffor Servlet env it's: > >> (File) > getServletContext().getAttribute("javax.servlet.context.tempdir"); > >> > >> Thanks > >> -Vincent > >> > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Denis Gervalle SOFTEC sa - CEO eGuilde sarl - CTO _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

