Bug 244198 - temp ee files left around
Summary: temp ee files left around
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.7 RC1   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance, readme
Depends on:
Blocks: 280464
  Show dependency tree
 
Reported: 2008-08-14 12:11 EDT by Jeff McAffer CLA
Modified: 2011-05-11 16:52 EDT (History)
7 users (show)

See Also:
Olivier_Thomann: review+


Attachments
one of the wayward ee files (625 bytes, application/octet-stream)
2008-08-27 23:17 EDT, Jeff McAffer CLA
no flags Details
proposed fix (5.31 KB, patch)
2010-04-13 11:25 EDT, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff McAffer CLA 2008-08-14 12:11:50 EDT
I was poking around my hard drive and found a mess of .ee files in the normal tempfile location (under the user dir).  these appear to be something related to debug and is creation or parsing of ee files.  Looks like hter eis a leak in the clean up code.  I had about 100 of them in there.  Not too big but still a leak
Comment 1 Darin Wright CLA 2008-08-18 15:06:50 EDT
Moving to PDE/API Tooling, which creates temp .ee files.
Comment 2 Michael Rennie CLA 2008-08-19 12:34:58 EDT
steps to reproduce:

1. create a new API baseline
2. kill eclipse using the process explorer (or the kill command from the command line)

If you then check your temp folder it will have left over .ee files in it.
The current state of the code sets the 'delete on exit' request for the temp file, but if the VM that created the temp file exits abnormally, it does not process the request.
Comment 3 Jeff McAffer CLA 2008-08-21 09:55:38 EDT
there may be other ways to reproduce this as I don't kill many Eclipse instances (nor do they generally crash) and yet my machine has/had quite a number of ee files.  Are these files create regardless of whether or not you have somethin gin your workspace?  The other option is that running tests that start a workspace might be causing this.  These are often killed in the process fo debugging etc.  Generally speaking however, for the things I have been doing, the workspaces are empty...
Comment 4 Michael Rennie CLA 2008-08-27 12:58:30 EDT
I found that there are two places we create temp ee files. 

Jeff what is the name of the file(s)? Is it one of 'eeFile.ee' or 'eed.ee'?
Comment 5 Jeff McAffer CLA 2008-08-27 23:17:22 EDT
Created attachment 111151 [details]
one of the wayward ee files

Here is one of the files.  eed22542.ee.  I have about 30 of them on my disk right now ranging in creation time over the past week or so.
Comment 6 Michael Rennie CLA 2008-09-02 15:31:31 EDT
interestingly, we already set the deleteOnExit flag for all eed*.ee temp files we make, and the flag was not being set for any of the eefile*.ee temp files.

I fixed the missing flag-setting for the eefile*.ee by removing the method that creates them (as it is not used anywhere), though I have no idea (yet) why any eed*.ee files would slip through the cracks, other than non-normal termination of the VM. 

Also cleaned up other unused methods from our Util class.

excerpt from the doc for deletOnExit: 

"Deletion will be attempted only for normal termination of the virtual machine, as defined by the Java Language Specification"

Comment 7 Michael Rennie CLA 2008-09-16 11:44:12 EDT
Jeff, are you still getting more and more left over .ee files?

I still cannot reproduce other than killing Eclipse (or having it crash), and the only place we create temp .ee files is during API baseline creation...
Comment 8 Michael Rennie CLA 2008-10-30 12:55:30 EDT
marking as worksforme
Comment 9 Michael Rennie CLA 2009-06-17 12:00:59 EDT
Reopening, testing our FileManager (part of the fix for bug 279729) it happened that I shut down my target Eclipse 'normally' and there were a bunch of the temp EE files left behind.

We could probably also manage them with the FileManager as a back-up in case the VM fails to clean them.
Comment 10 Michael Rennie CLA 2010-03-25 09:52:20 EDT
this is still happening, and needs to be fixed
Comment 11 Michael Rennie CLA 2010-04-13 11:25:23 EDT
Created attachment 164732 [details]
proposed fix

I found a couple of places where we were creating temp ee files without the deleteOnExit flag, so I added a new method to our Util class: createTempFile(prefix, postfix) which sets the deleteOnExit flag and adds the file to our file manager. I updated all occurrences of File.createTempFile(..) to Util.createTempFile(..)
Comment 12 Michael Rennie CLA 2010-04-13 11:28:37 EDT
marking as readme as note to not use File.createTempFile(..) but instead always use our delegate method Util.createTempFile(..)
Comment 13 Michael Rennie CLA 2010-04-13 11:54:01 EDT
applied patch to HEAD, please verify Olivier
Comment 14 Olivier Thomann CLA 2010-04-22 13:05:45 EDT
Verified.
Comment 15 Michael Rennie CLA 2011-04-25 11:54:17 EDT
Reopening.

Smoke testing 3.7M7, I went looking for something that was extracted to my profile temp folder - <root>\AppData\Local\Temp on win 7) - and found ~2200 temp ee files (1.6MB worth) in there.
Comment 16 Michael Rennie CLA 2011-05-11 16:52:24 EDT
testing this I found that the files are only left behind from improperly  terminating Eclipse / target workspaces - for example killing the process or using the terminate button in the console view for a target workspace - since none of the hooks to remove the files will be called.

I don't see anything more we can do here. Remarking as fixed
Comment 17 Michael Rennie CLA 2011-05-11 16:52:43 EDT
remarking verified.