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 187844 - StackOverflowError at ChildrenArray.nodes
Summary: StackOverflowError at ChildrenArray.nodes
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal with 5 votes (vote)
Assignee: Jaroslav Tulach
: 196541 (view as bug list)
Depends on:
Reported: 2010-06-20 01:12 UTC by jyeary
Modified: 2011-05-09 14:54 UTC (History)
18 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 170219

stacktrace (70.03 KB, text/plain)
2010-06-20 01:12 UTC, jyeary
stacktrace (70.07 KB, text/plain)
2010-09-13 17:14 UTC, adam_myatt
stacktrace (70.04 KB, text/plain)
2010-12-08 23:48 UTC, mperezma

Note You need to log in before you can comment on or make changes to this bug.
Description jyeary 2010-06-20 01:12:27 UTC
Build: NetBeans IDE 6.9 (Build 201006101454)
VM: Java HotSpot(TM) 64-Bit Server VM, 16.3-b01-279, Java(TM) SE Runtime Environment, 1.6.0_20-b02-279-10M3065
OS: Mac OS X

User Comments:
GUEST: opening a project

jyeary: Running GlassFish 3.0.1 in background while working on sample Swing application in foreground.

GUEST: This occured during startup

   at org.openide.util.Mutex.leave(
   at org.openide.util.Mutex$Privileged.exitReadAccess(
   at org.openide.nodes.EntrySupport$Default.getNodes(
   at org.openide.nodes.EntrySupport$Default.getNodes(
   at org.openide.nodes.Children.getNodes(
   at org.openide.nodes.Node.assignTo(
Comment 1 jyeary 2010-06-20 01:12:31 UTC
Created attachment 100248 [details]
Comment 2 Jaroslav Tulach 2010-06-29 17:21:26 UTC
Is this interesting for Nejedlák?
Comment 3 Exceptions Reporter 2010-07-07 17:23:35 UTC
This bug already has 10 duplicates 
Comment 4 adam_myatt 2010-09-13 17:14:44 UTC
Created attachment 102002 [details]

opening Andoird project
Comment 5 mperezma 2010-12-08 23:48:50 UTC
Created attachment 103778 [details]

Opening a svn-controlled project, in wich ".svn" folder has been removed frome project root folder (although some child folders still having their ".svn" folder)
Comment 6 Marian Mirilovic 2011-02-18 13:57:57 UTC
120 dups - at least P2 (reported also in NB 7.0 Beta 2)
Comment 7 Jaroslav Tulach 2011-02-18 17:34:31 UTC
This is probably an error in Node's usage, then an error in Nodes infrastructure. The stack overflowis generated while constructing an error message for to be thrown IllegalStateException. So something has been wrong before the StackOverFlowError.

I've made the code more robust in ergonomics#14c06bbc5ed9
Comment 8 Quality Engineering 2011-02-20 10:33:53 UTC
Integrated into 'main-golden', will be available in build *201102200501* on (upload may still be in progress)
User: Jaroslav Tulach <>
Log: #187844: Sometimes StackOverflowException is thrown when we attempt to assemble the exception message. Catch it.
Comment 9 Jaroslav Tulach 2011-03-11 08:28:31 UTC
*** Bug 196541 has been marked as a duplicate of this bug. ***
Comment 10 jsmith5and5 2011-05-09 14:54:05 UTC
I recently had the same problem and fixed it.

Problem: The same StackOverflowError occurred when I opened my NetBeans Platform application and expanded the project tree right away before the project had the chance to fully initialize. The result of the error was that the project tree showed as empty. To be clear, if the project was allowed to fully load, i.e. the user waits some time before expanding the tree, there was no problem.

Solution: The problem was in my NodeFactory.createNodes implementation for my project type. The (broken) implementation was something like this (I've simplified it to its essentials):

MyFileSystem fs = ...
FileObject root = fs.getRoot();
DataObject data = DataObject.find(root);
Node node = dataObject.getNodeDelegate();
return NodeFactorySupport.fixedNodeList(node);

Now, if the user waits for everything to load, createNodes is called only once and everything is fine. However, if the user expands the project tree before the project is loaded, createNodes is called twice: once for the user click and presumably once again when NB calls it programatically as part of its normal project load tasks. The StackOverflowError occurs during the second call. It fails because the node is already added to a parent from the first call.

Therefore, my solution was to create different top-level node instances each time createNodes was called by wrapping the nodes artificially with FilterNodes.

The NodeFactory.createNodes javadoc doesn't say anything about not allowing shared node instances for top-level nodes. Also, that doesn't really seem right to require that given that each DataObject is supposed to have only one node instance by design.

I'm not familiar enough with the code to judge the effort involved in making changes, but in my opinion, my first implementation of createNodes was reasonable and should have worked. Given the number of duplicates this bug has, I think I'm not alone. :)

P.S. I hope it's cool to comment on a resolved bug. This just seemed the best place for this.