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 184260 - NullPointerException at org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration.reCountLanguages
Summary: NullPointerException at org.netbeans.modules.cnd.makeproject.api.configuratio...
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-15 11:10 UTC by Alexander Simon
Modified: 2010-04-21 04:36 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 168081


Attachments
stacktrace (2.22 KB, text/plain)
2010-04-15 11:10 UTC, Alexander Simon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2010-04-15 11:10:32 UTC
Build: NetBeans IDE Dev (Build 100415-eade64a5bc80)
VM: OpenJDK Client VM, 14.0-b08, OpenJDK Runtime Environment, 1.6.0_0-b14
OS: Linux

Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration.reCountLanguages(MakeConfiguration.java:663)
   at org.netbeans.modules.cnd.makeproject.api.configurations.ConfigurationDescriptorProvider.recordMetricsImpl(ConfigurationDescriptorProvider.java:292)
   at org.netbeans.modules.cnd.makeproject.api.configurations.ConfigurationDescriptorProvider.recordMetrics(ConfigurationDescriptorProvider.java:188)
   at org.netbeans.modules.cnd.makeproject.configurations.ConfigurationXMLReader._read(ConfigurationXMLReader.java:219)
   at org.netbeans.modules.cnd.makeproject.configurations.ConfigurationXMLReader$1.runImpl(ConfigurationXMLReader.java:121)
   at org.netbeans.modules.cnd.utils.NamedRunnable.run(NamedRunnable.java:59)
Comment 1 Alexander Simon 2010-04-15 11:10:36 UTC
Created attachment 97431 [details]
stacktrace
Comment 2 Thomas Preisler 2010-04-16 19:15:03 UTC
OK, here is what I think is going on:

There is now a race condition when opening a unmanaged project and there are (many) files listed in the descriptor that no longer exists on disk. During reading the project, attachListeners() is called and it is now executed in it's own thread. In addition to attaching listeners, it also checks whether files exists or not and removes them from MakeConfigurationDescriptor.projectitems if they don't. And here is the race condition: we may get to reCountLanguages while items are being removed from projectitems from attachListeners().

There are many different fixes. Running attachListeners() in it's own thread is dangerous for the above reason so I just enabled the wait statement at the bottom of the function so it runs in sequeltial. This is how the code was originally written (sort of) and should fix the race condition.

Will close as Fixed.

It is however desirable to run attachListeners in parallel but it requires a (slightly) different approach. Will ask Alexander if he can come up with a safe solution for this.
Comment 3 Quality Engineering 2010-04-17 08:15:30 UTC
Integrated into 'main-golden', will be available in build *201004170515* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/3714851b2e54
User: Thomas Preisler <thp@netbeans.org>
Log: #184260 - NullPointerException at org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration.reCountLanguages
Comment 4 Alexander Simon 2010-04-20 09:27:31 UTC
This solution increases opening time of huge projects.
We should invent another solution.
Please revert modifications.
Comment 5 Alexander Simon 2010-04-20 09:35:41 UTC
changes was reverted
Comment 6 Alexander Simon 2010-04-20 10:07:08 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/6de9babb9967
Comment 7 Quality Engineering 2010-04-21 04:36:31 UTC
Integrated into 'main-golden', will be available in build *201004210200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6de9babb9967
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed BZ#184260 NullPointerException at org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration.reCountLanguages