This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 203739 - Output window temp storage files not removed if window not closed
Summary: Output window temp storage files not removed if window not closed
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Output Window (show other bugs)
Version: 7.0.1
Hardware: PC Windows XP
: P2 normal with 1 vote (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-14 15:36 UTC by ibeaumont
Modified: 2012-01-19 15:20 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ibeaumont 2011-10-14 15:36:15 UTC
I've just been looking at my temporary directory, and have found 2000 files starting "output...." which are created by Netbeans output window using the FileMapStorage.  It seems the files are only deleted if the window is closed.  Just closing the application doesn't clean up after itself.

Similar problems I think exist with these files that I think netbeans also creates...
"dict_cache..........tmp"
"mevenide..........pom"

From a platform point of view, the temp file created for my own output window is never removed, so better guidance in the API docs on how to make sure this happens is needed.  I close the stream, and then when the window is closed it trys to delete the file, but oldFile.delete() in FileMapStorage returns false and the file is not removed.
Comment 1 Jaroslav Havlin 2011-10-19 14:25:24 UTC
core-main/rev/b3f93edba4ee

Output Window:

Workaround for bug 4715154
(http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4715154) improved. It was
not sometimes possible to delete temporary files because they were associated
with some MappedByteBuffer instances.

Some files were not deleted because their writers were not correctly disposed.
This was also fixed.
Comment 2 Jaroslav Havlin 2011-10-20 09:25:38 UTC
dict_cache.......tmp files:

These files are created by JavaHelp library. They are not deleted because of a JDK bug, see http://bugs.sun.com/view_bug.do?bug_id=4171239 and http://bugs.sun.com/view_bug.do?bug_id=6357433 (it is a request for enhancement that should solve this problem).
Comment 3 Jaroslav Havlin 2011-10-20 09:52:04 UTC
mevenide..........pom files:

I have several Maven projects, but I have no files starting with "mevenide" in my temp directory. Maybe these files have no relation to NetBeans.

If you have new "mevenide..." files created when you start and close NetBeans, please report a new bug (probably product projects, component Maven) and describe steps to reproduce.
Comment 4 Jaroslav Havlin 2011-10-20 09:56:38 UTC
core-main/rev/b3f93edba4ee
Fixed.
Thank you for reporting.
Comment 5 ibeaumont 2011-10-20 10:05:25 UTC
I don't see how you can mark the issue as fixed?  The output files are still there.

If the solution is to wait to on
http://bugs.sun.com/view_bug.do?bug_id=6357433 

then surely it needs to be marked as waiting on that, as that would still need code changes as it is a new API that is proposed.

I also believe there is still a defect in the code though, as if you don't ever close the window it will make no attempt to delete the file and the code doesn't use "deleteOnExit" (probably because of issues surrounding that). So there should be some type of clean up operation on exit to at least make an attempt to delete the files.
Comment 6 ibeaumont 2011-10-20 10:31:13 UTC
(In reply to comment #5)
> I don't see how you can mark the issue as fixed?  The output files are still
> there.
> 
> If the solution is to wait to on
> http://bugs.sun.com/view_bug.do?bug_id=6357433 
> 
> then surely it needs to be marked as waiting on that, as that would still need
> code changes as it is a new API that is proposed.
> 
> I also believe there is still a defect in the code though, as if you don't ever
> close the window it will make no attempt to delete the file and the code
> doesn't use "deleteOnExit" (probably because of issues surrounding that). So
> there should be some type of clean up operation on exit to at least make an
> attempt to delete the files.

Sorry, please ignore this comment, as I see code changes have been made.  I'll see what happens in the next NB release to see if it behaves better.

Thank you.
Comment 7 Jaroslav Havlin 2011-10-20 11:51:01 UTC
You are right, the JavaHelp problem should be filed separately. I have created bug 204005. But I still think that this should be fixed in JDK for Windows, because it works correctly on Linux, for example.

I believe the Output Window problem is fixed now. The cleanup is made by shutdown hook registered in the static constructor of class FileMapStorage. I tested it and it worked.

Thank you for your comments.
Comment 8 Quality Engineering 2011-10-20 14:30:35 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/b3f93edba4ee
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #203739 - Output window temp storage files not removed if window not closed
Comment 9 Tomas Danek 2011-12-12 14:34:21 UTC
ibeaumont, can you please verify once 7.1 is released and mark as verified then? 

Thanks in advance
Comment 10 ibeaumont 2012-01-19 15:20:58 UTC
Verified it is fixed.  Thanks