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 268034

Summary: NetBeans may fail to start because of NPE/GC
Product: profiler Reporter: Jiri Sedlacek <jis>
Component: BaseAssignee: Tomas Hurka <thurka>
Status: RESOLVED FIXED    
Severity: normal Keywords: VISUALVM
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description Jiri Sedlacek 2016-09-15 08:15:22 UTC
OutOfMemoryError: GC overhead limit exceeded may be thrown during NetBeans startup on Windows, see https://java.net/jira/browse/VISUALVM-593. Caused by listing a potentially large number of files in TEMP directory.

In org.netbeans.lib.profiler.utils.MiscUtils.deleteHeapTempFiles() we can now use new Java 7 APIs to iterate over files in directory without throwing OOMEs, see Files.newDirectoryStream() or Files.walkFileTree().


java.lang.OutOfMemoryError: GC overhead limit exceeded
   at java.util.Arrays.copyOf(Arrays.java:2367)
   at java.lang.String.<init>(String.java:168)
   at java.io.Win32FileSystem.resolve(Win32FileSystem.java:259)
   at java.io.File.<init>(File.java:262)
   at java.io.File.listFiles(File.java:1206)
   at org.netbeans.lib.profiler.utils.MiscUtils.deleteHeapTempFiles(MiscUtils.java:518)
   at org.netbeans.modules.profiler.ProfilerModule.restored(ProfilerModule.java:134)
   at org.netbeans.core.startup.NbInstaller.loadCode(NbInstaller.java:471)
   at org.netbeans.core.startup.NbInstaller.loadImpl(NbInstaller.java:394)
   at org.netbeans.core.startup.NbInstaller.access$000(NbInstaller.java:105)
   at org.netbeans.core.startup.NbInstaller$1.run(NbInstaller.java:346)
   at org.openide.filesystems.FileUtil$2.run(FileUtil.java:435)
   at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:127)
   at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:609)
   at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:419)
   at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:439)
   at org.netbeans.core.startup.NbInstaller.load(NbInstaller.java:343)
   at org.netbeans.ModuleManager.enable(ModuleManager.java:1194)
   at org.netbeans.ModuleManager.enable(ModuleManager.java:1017)
   at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:340)
   at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:276)
   at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:301)
   at org.netbeans.core.startup.Main.getModuleSystem(Main.java:181)
   at org.netbeans.core.startup.Main.getModuleSystem(Main.java:150)
   at org.netbeans.core.startup.Main.start(Main.java:307)
   at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
   at java.lang.Thread.run(Thread.java:745)
Comment 1 Tomas Hurka 2016-09-15 10:32:31 UTC
Fixed in profiler-main

changeset:   300152:b7920448eec8
user:        Tomas Hurka <thurka@netbeans.org>
date:        Thu Sep 15 12:29:44 2016 +0200
summary:     bugfix #268034, use DirectoryStream (instead of File.listFiles()) to avoid OOME on directories with large number of files
Comment 2 Quality Engineering 2016-09-16 02:28:41 UTC
Integrated into 'main-silver', will be available in build *201609160002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b7920448eec8
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #268034, use DirectoryStream (instead of File.listFiles()) to avoid OOME on directories with large number of files