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 230469 - ProjectOpenedHookImpl instance recreated within a single project
Summary: ProjectOpenedHookImpl instance recreated within a single project
Status: RESOLVED DUPLICATE of bug 232400
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on: 232400
Blocks:
  Show dependency tree
 
Reported: 2013-05-29 15:40 UTC by sreimers
Modified: 2013-07-25 10:43 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Assertion as displayed (3.29 KB, text/plain)
2013-05-29 15:40 UTC, sreimers
Details
ide and ui gesture logs (85.08 KB, application/x-zip-compressed)
2013-06-04 15:43 UTC, sreimers
Details
stacktrace (5.14 KB, text/plain)
2013-06-17 12:30 UTC, Milos Kleint
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sreimers 2013-05-29 15:40:45 UTC
Created attachment 135082 [details]
Assertion as displayed

Switching project groups gives assertion. See attached file.
Comment 1 Milos Kleint 2013-06-04 10:05:12 UTC
please attach the IDE log which should have the important logs with regard to this issue.. related to issue 224012

please reopen with the log file, thanks.
Comment 2 sreimers 2013-06-04 15:43:14 UTC
Created attachment 135339 [details]
ide and ui gesture logs
Comment 3 Milos Kleint 2013-06-17 07:01:28 UTC
below are the creation stacktraces for ProjectOpenedHook - using jdk 8

INFO [org.netbeans.modules.maven.NbMavenProjectImpl]:     first creation stacktrace
java.lang.Exception: Thread:Opening projects at 1369818424840
	at org.netbeans.modules.maven.ProjectOpenedHookImpl.checkIssue224012(ProjectOpenedHookImpl.java:478)
	at org.netbeans.modules.maven.ProjectOpenedHookImpl.<init>(ProjectOpenedHookImpl.java:150)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:414)
	at org.netbeans.modules.projectapi.LazyLookupProviders.loadPSPInstance(LazyLookupProviders.java:166)
	at org.netbeans.modules.projectapi.LazyLookupProviders.access$000(LazyLookupProviders.java:73)
	at org.netbeans.modules.projectapi.LazyLookupProviders$1$1.beforeLookup(LazyLookupProviders.java:103)
	at org.openide.util.lookup.ProxyLookup.beforeLookup(ProxyLookup.java:210)
	at org.openide.util.lookup.ProxyLookup$R.myBeforeLookup(ProxyLookup.java:653)
	at org.openide.util.lookup.ProxyLookup$R.beforeLookup(ProxyLookup.java:675)
	at org.openide.util.lookup.ProxyLookup$LazyCollection.computeDelegate(ProxyLookup.java:1103)
	at org.openide.util.lookup.ProxyLookup$LazyCollection.access$900(ProxyLookup.java:1033)
	at org.openide.util.lookup.ProxyLookup$LazyCollection$1.hasNext(ProxyLookup.java:1233)
	at org.netbeans.spi.project.ui.support.UILookupMergerSupport$OpenHookImpl.projectOpened(UILookupMergerSupport.java:246)
	at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectOpened(ProjectOpenedHook.java:85)
	at org.netbeans.modules.project.ui.OpenProjectList.notifyOpened(OpenProjectList.java:1228)
	at org.netbeans.modules.project.ui.OpenProjectList.doOpenProject(OpenProjectList.java:1309)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:791)
[catch] at org.netbeans.modules.project.ui.OpenProjectList$5.run(OpenProjectList.java:659)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
INFO [org.netbeans.modules.maven.NbMavenProjectImpl]:     second creation stacktrace
java.lang.Exception: Thread:org.netbeans.modules.project.ui.groups.GroupsMenu at 1369841727031
	at org.netbeans.modules.maven.ProjectOpenedHookImpl.checkIssue224012(ProjectOpenedHookImpl.java:478)
	at org.netbeans.modules.maven.ProjectOpenedHookImpl.<init>(ProjectOpenedHookImpl.java:150)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:414)
	at org.netbeans.modules.projectapi.LazyLookupProviders.loadPSPInstance(LazyLookupProviders.java:166)
	at org.netbeans.modules.projectapi.LazyLookupProviders.access$000(LazyLookupProviders.java:73)
	at org.netbeans.modules.projectapi.LazyLookupProviders$1$1.beforeLookup(LazyLookupProviders.java:103)
	at org.openide.util.lookup.ProxyLookup.beforeLookup(ProxyLookup.java:210)
	at org.openide.util.lookup.ProxyLookup$R.myBeforeLookup(ProxyLookup.java:653)
	at org.openide.util.lookup.ProxyLookup$R.beforeLookup(ProxyLookup.java:675)
	at org.openide.util.lookup.ProxyLookup$LazyCollection.computeDelegate(ProxyLookup.java:1103)
	at org.openide.util.lookup.ProxyLookup$LazyCollection.access$900(ProxyLookup.java:1033)
	at org.openide.util.lookup.ProxyLookup$LazyCollection$1.hasNext(ProxyLookup.java:1233)
	at org.netbeans.spi.project.ui.support.UILookupMergerSupport$OpenHookImpl.projectOpened(UILookupMergerSupport.java:246)
	at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectOpened(ProjectOpenedHook.java:85)
	at org.netbeans.modules.project.ui.OpenProjectList.notifyOpened(OpenProjectList.java:1228)
	at org.netbeans.modules.project.ui.OpenProjectList.doOpenProject(OpenProjectList.java:1309)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:791)
	at org.netbeans.modules.project.ui.groups.Group.open(Group.java:593)
	at org.netbeans.modules.project.ui.groups.Group.setActiveGroup(Group.java:191)
	at org.netbeans.modules.project.ui.groups.GroupsMenu$Menu$1$1.run(GroupsMenu.java:172)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
WARNING [org.netbeans.modules.maven.NbMavenProjectImpl]: Spotted issue 224012 (https://netbeans.org/bugzilla/show_bug.cgi?id=224012). Please report the incident.
Comment 4 Milos Kleint 2013-06-17 12:30:22 UTC
still cannot find out what's wrong.

the 2 stacktraces are separated by about half a day. So apparently the project was opened, later closed and when switching groups opened again. In the mean time something happened to the project's lookup and the LazyLookupProviders.forProjectServiceProvider() instance was re-created or reset. But it's not a multiple threads accessing the same PSP instance most likely, but rather 2 distinct instances of of PSP. (given the multi-hour spread)
There are instances of ProjectOpenedHook that register multiple interfaces along with POH, however I hasn't found a way how it would compromise the integrity of the single PSP.

One level above PSP is the PackagingTypeDependentLookup (ProxyLookup subclass) that switches the packaging dependent section of the lookup. All POH instances appear be non-packaging dependent meaning the layer lookup content should be constant and always part of the PackagingTypeDependentLookup, assuming the POH's PSP cannot get dereferenced/reloaded here. OTOH any packaging specific lookup entries will always get reloaded and thrown away.

The outer layer is the LookupProviderSupport.createCompositeLookup -> DelegatingLookupImpl (ProxyLookup subclass). That gets the fixed base lookup with live instances from the project and the PackagingTypeDL with only PSPs inside. As said before, only PSPs for specific packaging will appear and disappear, otherwise the content should be stable. The only other way of PSPs appearing/disappearing is module enablement state changes. That's not applicable in our case I believe as POH instance we have is in the same module as the project type.

the doDelegate() method in DelegatingLookupImpl is the most complex beast here. There is a certain recursive unwrapping embedded in the code (as demonstrated by the attached stacktrace). So unless the problem is outside of the project space in Lookup (fixed, exclude and proxy lookups) itself, I would bet on something in the doDelegate() method.  Especially the fact that we repeatedly recreate LookupResults for Mergers and add/remove listeners to them, all recursively multiple times is suspicious.
Getting rid of MetaLookupMerger could make the code a bit simpler I'm not convinced these are at the root of the problem.
Comment 5 Milos Kleint 2013-06-17 12:30:51 UTC
Created attachment 135884 [details]
stacktrace
Comment 6 Quality Engineering 2013-06-18 14:50:06 UTC
Integrated into 'main-golden', will be available in build *201306181109* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c2cb1b59827d
User: Milos Kleint <mkleint@netbeans.org>
Log: #230469 more details logged
Comment 7 Milos Kleint 2013-06-20 07:52:20 UTC
(In reply to comment #4)
> 
> the doDelegate() method in DelegatingLookupImpl is the most complex beast here.
> There is a certain recursive unwrapping embedded in the code (as demonstrated
> by the attached stacktrace). 

recursive behaviour was likely caused by the additional logging done. Cannot reproduce when logging just stacktraces in doDelegate()
Comment 8 Milos Kleint 2013-07-25 10:43:48 UTC
I'm going to close this as duplicate, given where the fix is I suppose we are facing the same issue

*** This bug has been marked as a duplicate of bug 232400 ***