Bug 127367 - NullPointerException at org.openide.nodes.Children$Info.useNodes
NullPointerException at org.openide.nodes.Children$Info.useNodes
Status: VERIFIED FIXED
Product: db
Classification: Unclassified
Component: Code
6.x
All All
: P1 (vote)
: 6.x
Assigned To: David Vancouvering
issues@db
http://statistics.netbeans.org/except...
EXCEPTIONS_REPORT
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-14 10:26 UTC by Roman Mostyka
Modified: 2008-03-06 00:37 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (6.84 KB, text/plain)
2008-02-14 10:26 UTC, Roman Mostyka
Details
Updated stack trace (3.60 KB, text/plain)
2008-02-29 16:31 UTC, Petr Jiricka
Details
stacktrace (1.54 KB, text/plain)
2008-03-01 23:45 UTC, Ivan Sidorkin
Details
stacktrace (1.61 KB, text/plain)
2008-03-02 20:53 UTC, Marian Mirilovic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2008-02-14 10:26:03 UTC
Build: NetBeans IDE Dev (Build 200802140010)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: Windows XP, 5.1, x86

User Comments: 
1. Installed "Visual Web JSF Backwards Compatibility Kit" plugin.
2. Added new MySQL connection.

Result: NullPointerException arises.
Comment 1 Roman Mostyka 2008-02-14 10:26:08 UTC
Created attachment 56662 [details]
stacktrace
Comment 2 Lukas Hasik 2008-02-14 10:32:44 UTC
reassigning to db for evaluation
Comment 3 David Vancouvering 2008-02-15 17:34:07 UTC
Sorry, with the latest bits, I can't reproduce.

Looking at the stack trace, it's hard to understand how it could happen unless there is a threading bug, as
DatabaseNodeInfo calls add with a new node array instantiated with a node that it checked to see was not null.  But when
Children.java hits it, the node is null.

I am suspecting this is related to your other issues with managing connections which have appeared to have gone away
with the latest bits.  I will close with WORKSFORME, and please re-open if you see it again.
Comment 4 Roman Mostyka 2008-02-18 17:52:26 UTC
Fixed. 
Comment 5 Roman Mostyka 2008-02-18 17:52:40 UTC
Fixed.
Comment 6 Roman Mostyka 2008-02-18 17:53:03 UTC
Verified with build 080218.
Comment 7 Petr Jiricka 2008-02-29 16:30:18 UTC
I am hitting this issue again in build 770 from deadlock. For me, the steps to reproduce are:
1. Create a new web project
2. From the first panel of the wizard, choose Add server (I used the zip build so there are no servers to start with)
3. Add GlassFish v2 using the Add Server wizard
4. On finishing the wizard and returning back to the new web project wizard, I got the exception, see new stack trace in
the attachment.


Comment 8 Petr Jiricka 2008-02-29 16:31:48 UTC
Created attachment 57562 [details]
Updated stack trace
Comment 9 Ivan Sidorkin 2008-03-01 23:45:27 UTC
Build: NetBeans IDE Dev (Build 200803011643)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Windows XP, 5.1, x86

User Comments: 
selected Services tab
Comment 10 Ivan Sidorkin 2008-03-01 23:45:31 UTC
Created attachment 57613 [details]
stacktrace
Comment 11 Marian Mirilovic 2008-03-02 20:53:25 UTC
Build: NetBeans IDE Dev (Build 200803021202)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Linux, 2.6.12-10-686, i386

User Comments: 
Downloaded Java SE distro and run with new userdir
Comment 12 Marian Mirilovic 2008-03-02 20:53:28 UTC
Created attachment 57622 [details]
stacktrace
Comment 13 Marian Mirilovic 2008-03-02 20:56:18 UTC
Exception on startup - download Java SE distro and run it against new userdir -> NPE rises
Comment 14 David Vancouvering 2008-03-03 17:10:37 UTC
Just discovered this bug after being offline over the weekend.  Will get it fixed ASAP.
Comment 15 David Vancouvering 2008-03-03 17:30:42 UTC
I am noticing that these issues seem to arise when using J2EE/Visualweb functionality.  So I am suspicious that I am not
seeing this because I am running with the 'basic' configuration.   Building with the 'standard' cluster configuration
and will see if I can reproduce.

Meanwhile while the build's going on I'll look at the code and see if I can determine the cause through inspection.
Comment 16 David Vancouvering 2008-03-03 18:48:16 UTC
Unable to reproduce on startup with clean userdir and a fresh build from main.  Am downloading Glassfish V2 to see if I
can reproduce that way.

mmirolivic, can you please give me the following information:
- which build are you using - standard build, basic build, full build or something else?
- which VM are you using?  I can't tell if "Java HotSpot(TM) Client VM, 10.0-b19" which VM this is - Java 5 or Java 6

Thanks.
Comment 17 David Vancouvering 2008-03-03 18:51:18 UTC
Further inspection of the stack trace is uncovering the cause to me - it happens when registering Java DB that is
discovered in JDK 6 or when Glassfish is registered.

I'll install JDK 6 and see if I can reproduce that way.
Comment 18 David Vancouvering 2008-03-03 18:54:49 UTC
Further inspection of the stack trace is uncovering the cause to me - it happens when registering Java DB that is
discovered in JDK 6 or when Glassfish is registered.

I'll install JDK 6 and see if I can reproduce that way.
Comment 19 David Vancouvering 2008-03-03 19:11:33 UTC
Reproduced (yay!).  I reproduce by manually registering Java DB.  Now I can work on tracking down the cause.
Comment 20 Marian Mirilovic 2008-03-03 23:58:40 UTC
David,
> mmirolivic, can you please give me the following information:
> - which build are you using - standard build, basic build, full build or something else?

as you can see in my original report, I am using Java SE distribution

> - which VM are you using?  I can't tell if "Java HotSpot(TM) Client VM, 10.0-b19" which VM this is - Java 5 or Java 6
jdk 1.6.0_04
Comment 21 David Vancouvering 2008-03-04 06:14:34 UTC
Update: this is a Heisenbug.  Due to a threading conflict that I have yet to unravel, the Java DB node gets added twice,
and this causes subsequent corruptions in the node hierarchy that results in the NPE.

Stepping through in the debugger and/or adding log statements that print out stack traces to track down what threads are
participating in the problem makes the behavior go away.

Now attempting to track down without the use of log statements or the debugger.  Are we having fun yet?
Comment 22 David Vancouvering 2008-03-04 09:17:02 UTC
Placed synchronization in a number of places where it was missing, and now it is working for me in my sandbox.  I will
work on getting this integrated into the trunk.
Comment 23 David Vancouvering 2008-03-04 10:13:42 UTC
Fixed in main http://hg.netbeans.org/main?cmd=changeset;node=5490ae2f3361

Need to merge into beta1 repository after verification.

Jan Horvath is verifying...
Comment 24 Jan Horvath 2008-03-04 10:31:31 UTC
verified in main. please integrate into beta1 repository.
Comment 25 David Vancouvering 2008-03-04 10:55:04 UTC
Merged into beta branch

http://hg.netbeans.org/release61-beta?cmd=changeset;node=889b9cf9fe5b
Comment 26 Andrei Badea 2008-03-04 13:31:43 UTC
I can't argue about the correctness of the changes because the threading model of DatabaseNodeChildren was already
incomprehensible. To quote a comment at the end of the file, which is about five years old, "this entire class is junk".
It should have been thrown away a long time ago, and it is quite dissapointing that someone still has to struggle
maintaining it.

That being said, David's changes do seem to improve the current state, so I agree with them. Unfortunately, I don't
think they are the correct fix, which would be to "have a sensible data model independent of nodes and display it using
Children.Keys [...] and everything would be much easier" (to quote from the class again). However, that fix would
require heavy changes to the DB Explorer, changes that have always been unpopular. Again, it is quite demotivating (to
me at least) to see how we focus on better database support without addressing the infrastructure issues first.

A nitpick (not intended to block the integration into the beta branch): synchronization is not needed on getProperty()
and getBooleanProperty() in MySQLOptions. Similarly, it is not needed on ServerNodeProvider.getNodes().
Comment 27 Petr Hejl 2008-03-04 13:43:19 UTC
Just few hints (probably not necessary for beta).

- Is there real need for usage of three different loggers in single class (DatabaseNodeChildren.java)?
- No need to synchronize static MySQLOptions.getDefault()
- MySQLOptions listeners are not thread safe, use CopyOnWriteArrayList
- Some unit test case should be prepared to avoid future regressions
- It is always good idea to document which lock is used for the field being synchronized
Comment 28 David Vancouvering 2008-03-04 18:24:09 UTC
Thanks for your comments, your suggested changes are very useful; I have made the changes and will push into main (not
beta branch).

Petr, regarding your comment on unit tests, I am well aware of this.  I had to set this aside as I had features that I
wanted to get in for beta.  Unit tests are my main task for the beta period (aside from fixing P1s/P2s).

David
Comment 29 Marian Mirilovic 2008-03-05 14:41:56 UTC
I haven't seen that exception any more - verified.
Comment 30 David Vancouvering 2008-03-06 00:37:38 UTC
Some small changes based on review comments

http://hg.netbeans.org/main?cmd=changeset;node=c5af08a950f9


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo