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 62247 - IOE at startup: Could not delete: ...\all-layers.dat
Summary: IOE at startup: Could not delete: ...\all-layers.dat
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 4.x
Hardware: PC Windows 95/98
: P3 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
: 64064 64139 65091 67798 71624 71873 (view as bug list)
Depends on: 72930
Blocks:
  Show dependency tree
 
Reported: 2005-08-13 15:22 UTC by ero
Modified: 2008-12-23 08:40 UTC (History)
4 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 ero 2005-08-13 15:22:40 UTC
Hello,
 
Here is a problem happening when I launch NetBeans 4.1 on a Windows98 platform:
 
    java.io.IOException: Could not delete:
C:\WINDOWS\.netbeans\4.1\var\cache\all-layers.dat
 
You will see all detail down here...
 
It's not important for me, I just want to help. Thanks for having permitted me
to download this IDE for free ! It helps me keep an eye on java evolution.

ero.


---------------


-------------------------------------------------------------------------------
>Log Session: Friday, August 12, 2005 4:22:58 PM CEST
>System Info: 
  Product Version       = NetBeans IDE 4.1 (Build 200505031930)
  Operating System      = Windows 98 version 4.10 running on x86
  Java; VM; Vendor      = 1.5.0_04; Java HotSpot(TM) Client VM 1.5.0_04-b05; Sun
Microsystems Inc.
  Java Home             = D:\PROGRAM FILES\JAVA\JDK1.5.0_04\JRE
  System Locale; Encod. = fr_FR (nb); Cp1252
  Home Dir; Current Dir = C:\WINDOWS; D:\program files\netbeans-4.1
  IDE Install; User Dir = D:\PROGRAM FILES\NETBEANS-4.1\PLATFORM5;
C:\WINDOWS\.netbeans\4.1
  CLASSPATH             = D:\PROGRAM
FILES\NETBEANS-4.1\PLATFORM5\lib\boot.jar;D:\program
files\Java\jdk1.5.0_04\lib\dt.jar;D:\program files\Java\jdk1.5.0_04\lib\tools.jar
  Boot & ext classpath  = D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\rt.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\i18n.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\sunrsasign.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\jsse.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\jce.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\charsets.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\classes;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\ext\dnsns.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\ext\sunjce_provider.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\ext\sunpkcs11.jar;D:\PROGRAM
FILES\JAVA\JDK1.5.0_04\JRE\lib\ext\localedata.jar
  Dynamic classpath     = D:\program
files\netbeans-4.1\platform5\core\core.jar;D:\program
files\netbeans-4.1\platform5\core\openide-loaders.jar;D:\program
files\netbeans-4.1\platform5\core\openide.jar;D:\program
files\netbeans-4.1\platform5\core\org-netbeans-swing-plaf.jar;D:\program
files\netbeans-4.1\platform5\core\updater.jar;D:\program
files\netbeans-4.1\nb4.1\core\org-netbeans-upgrader.jar;D:\program
files\netbeans-4.1\nb4.1\core\locale\core_nb.jar;D:\program
files\netbeans-4.1\ide5\core\org-netbeans-modules-utilities-cli.jar
-------------------------------------------------------------------------------
[org.netbeans.core.modules #4] Upgrading 'jar' param from
org-netbeans-modules-profiler-j2ee.jar to
modules/eager/org-netbeans-modules-profiler-j2ee.jar and removing 'origin'
installation/eager
[org.netbeans.core.modules #4] Warning - had to upgrade dependencies for module
org.netbeans.modules.profiler.j2ee: added = [module
org.netbeans.modules.projectapi/1 > 1.3, module
org.netbeans.modules.java.platform/1 > 1.3, module
org.netbeans.modules.project.ant/1 > 1.3] removed = [module
org.netbeans.modules.java.platform/0, module org.netbeans.modules.project.ant/0
> 1.0, module org.netbeans.modules.projectapi/0 > 1.0]; details: [Major release
version of module changed from 0 to 1 to signal stability; update your dependencies]
[org.netbeans.core.projects] INFORMATIONAL *********** Exception occurred
************ at 4:23 PM on Aug 12, 2005
java.io.IOException: Could not delete:
C:\WINDOWS\.netbeans\4.1\var\cache\all-layers.dat
	at
org.netbeans.core.projects.cache.BinaryCacheManager.cleanupCache(BinaryCacheManager.java:56)
	at
org.netbeans.core.projects.cache.BinaryCacheManager.store(BinaryCacheManager.java:88)
	at
org.netbeans.core.projects.cache.ParsingLayerCacheManager.store(ParsingLayerCacheManager.java:87)
[catch] at
org.netbeans.core.projects.ModuleLayeredFileSystem$1.run(ModuleLayeredFileSystem.java:254)
	at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:89)
	at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:432)
	at
org.netbeans.core.projects.ModuleLayeredFileSystem.setURLs(ModuleLayeredFileSystem.java:242)
	at
org.netbeans.core.projects.ModuleLayeredFileSystem.addURLs(ModuleLayeredFileSystem.java:315)
	at org.netbeans.core.modules.NbInstaller.loadLayers(NbInstaller.java:559)
	at org.netbeans.core.modules.NbInstaller.load(NbInstaller.java:205)
	at org.netbeans.core.modules.ModuleManager.enable(ModuleManager.java:869)
	at org.netbeans.core.modules.ModuleList.installNew(ModuleList.java:382)
	at org.netbeans.core.modules.ModuleList.trigger(ModuleList.java:316)
	at org.netbeans.core.modules.ModuleSystem.restore(ModuleSystem.java:253)
	at org.netbeans.core.NonGui.run(NonGui.java:355)
	at org.netbeans.core.Main.run(Main.java:185)
	at org.netbeans.core.NbTopManager.getNbTopManager(NbTopManager.java:241)
	at org.netbeans.core.NbTopManager.get(NbTopManager.java:190)
	at org.netbeans.core.Main.start(Main.java:311)
	at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90)
	at java.lang.Thread.run(Thread.java:595)
Comment 1 Milan Kubec 2005-08-17 09:03:50 UTC
I suppose it's not important since the exception is marked as INFORMATIONAL,
reassigning just to be sure.
Comment 2 Jesse Glick 2005-08-17 11:26:01 UTC
No idea how to go about reproducing this. java.io.File.delete() just returns
false if deletion fails; there is no way to get details from the operating
system as to what is wrong. Perhaps the directory - or drive - was read-only at
the time; perhaps some other process had that file open; etc. Unless this is
known to happen to other people (only Win98?) I will have to close, I guess.
Comment 3 ero 2005-08-19 08:43:12 UTC
Thank you for your opinion. As I said in the query, it's not a problem for me, I
can live with it, and I don't mind if you close this query. I agree that it
could be only a win98 problem.

Here is my comment:
- it is not a question of read-only in file properties (I checked this and also
the parent folders)
- it happens systematically, each time I launch NetBeans, as sure as a
mathematical operation

I'll keep an eye on this query to see if you have any more questions.
Best respects.
ero.
Comment 4 Petr Nejedly 2005-08-19 15:44:31 UTC
The process that opened the file was the IDE itself. It actually mapped the file.
The problem is that the file was mmaped, then recognized as out of date and
about to be recreated.
java.nio has no way of explicit unmapping, and Windows can't delete the file
while mapped (ugh, every sane OS manages that correctly, yet windows is much
more prone to lost clusters...). In my experience, it was at least possible to
rename the file, but it seems Win98 fails even on that.

As a workaround, you can delete the file yourself, it will get recreated during
next startup and should stay that way (no more recreations during subsequent
startups) as long as you don't change the module set.

If we wanted to fix this, we'd have to special-case Win98 and create a
HeapByteBuffer instead.
Comment 5 Jesse Glick 2005-08-19 22:52:36 UTC
I guess you're talking about the BinaryFS constructor. So there's no way to
close a mmap'd file except by GCing the MappedByteBuffer? That's awful!
Comment 6 ero 2005-08-21 13:04:05 UTC
Work-around seems to work well...
Thank very much you for your response, I don't need more.
At least we know now the cause of the problem!
ero.
Comment 7 Jesse Glick 2005-09-15 18:53:03 UTC
*** Issue 64064 has been marked as a duplicate of this issue. ***
Comment 8 Marian Mirilovic 2005-09-26 08:26:45 UTC
*** Issue 65091 has been marked as a duplicate of this issue. ***
Comment 9 Marian Mirilovic 2005-09-26 08:27:14 UTC
*** Issue 64139 has been marked as a duplicate of this issue. ***
Comment 10 colinj 2005-10-07 19:13:01 UTC
I'm wondering what a work-around might be for this?

I've seen the same behavior on WinXP when the IDE starts up and attempts to open
files in my users' roaming profiles.

Comment 11 Jesse Glick 2005-10-07 21:42:09 UTC
Petr do you have some idea how to deal with this? I don't even know how to
reproduce it. It seems that you already put in the code which uses mmaped
buffers and which therefore renames, rather than deletes, the file, to work
around the Windows bug. (Is that filed for the JDK? Should use jdk_bug_NNNNNNN
in status whiteboard.) If this is really a GC problem, the only thing I can
think to do is insert

if (!renamed) {
    System.gc();
    renamed = cacheFile.renameTo(tmpFile); // try again
}

but I have no way of testing whether such a fix really works. I suspect it would
not be reliable. If it really worled, it would make startup a bit slower for
affected machines, but no exception at least.

If that doesn't work, we could consider creating alternate all-layers1.dat and
all-layers2.dat and permitting either to be used. (But what if both exist...?)
Or, if cleanupCache() when called from store() fails, just print the IOE message
to console as a warning, then pick a new cacheFile - meaning, I guess, that the
caching would not actually work, and startup would be longer.

Or, as you suggest, create an in-memory byte buffer. Problem is that you would
have to create it only conditionally, to avoid damaging performance on other
platforms, and I am not sure if just checking for "98" in the OS name is
reliable enough. Last comment suggests that other Windows machines can be
affected sometimes.
Comment 12 Jan Chalupa 2005-10-08 18:00:52 UTC
Jarda, try to look at this one. I thought the trick with renaming the file was
already in.
Comment 13 Petr Nejedly 2005-10-10 09:03:50 UTC
The renaming code is there from the beginning. The problem is that win98 won't
let you even rename an opened file.
The only occurence on non-w98 (issue 64064) seems to be more of a configuration
issue (special networked setup) that this actual problem.

If we could recognize w98, I'd go for HeapByteBuffer on that platform.
Comment 14 Jaroslav Tulach 2005-10-25 11:03:42 UTC
"#62247: Hoping to fix the problem for Windows98. #1 - we try a bit harder to 
GC the mmaped handle, #2 - if the rename files we still mark the file as 
delete on exit, so even if the exception is printed, next start should be ok" 
Checking in 
startup/src/org/netbeans/core/startup/layers/BinaryCacheManager.java; 
/cvs/core/startup/src/org/netbeans/core/startup/layers/BinaryCacheManager.java,v  
<--  BinaryCacheManager.java 
new revision: 1.2; previous revision: 1.1 
 
Comment 15 Jaroslav Tulach 2005-11-01 15:34:03 UTC
*** Issue 67798 has been marked as a duplicate of this issue. ***
Comment 16 Petr Nejedly 2006-01-19 22:07:23 UTC
*** Issue 71624 has been marked as a duplicate of this issue. ***
Comment 17 Jesse Glick 2006-01-25 22:32:16 UTC
*** Issue 71873 has been marked as a duplicate of this issue. ***
Comment 18 Jaroslav Tulach 2006-03-13 12:54:25 UTC
*** Issue 72930 has been marked as a duplicate of this issue. ***