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 232400 - RecorgnizeInstanceObjects lookup can be empty was: IllegalStateException from JWSProjectOpenHook
Summary: RecorgnizeInstanceObjects lookup can be empty was: IllegalStateException from...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Options&Settings (show other bugs)
Version: 7.2
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: ERGONOMICS
: 230469 232516 232949 233320 234463 235590 (view as bug list)
Depends on:
Blocks: 230469
  Show dependency tree
 
Reported: 2013-07-08 16:56 UTC by Tomas Zezula
Modified: 2013-09-17 11:58 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
LazyLookupProviders.java diff (2.99 KB, patch)
2013-07-08 18:49 UTC, Tomas Zezula
Details | Diff
Reusing previous FolderLookup in RecognizeInstanceObjects seems to fix the problem (4.18 KB, patch)
2013-07-24 08:58 UTC, Jaroslav Tulach
Details | Diff
stacktrace (1.05 KB, text/plain)
2013-07-24 13:33 UTC, Martin Kanak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2013-07-08 16:56:21 UTC
java.lang.IllegalStateException: Listener 136505312 is not attached to J2SEProjectPlatform 732243788 for Project JavaApplication1.
	at org.netbeans.modules.javawebstart.JWSProjectOpenHook$PlatformListener.detach(JWSProjectOpenHook.java:219)
	at org.netbeans.modules.javawebstart.JWSProjectOpenHook.projectClosed(JWSProjectOpenHook.java:164)
	at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectClosed(ProjectOpenedHook.java:89)
	at org.netbeans.spi.project.ui.support.UILookupMergerSupport$OpenHookImpl.projectClosed(UILookupMergerSupport.java:260)
	at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectClosed(ProjectOpenedHook.java:89)
[catch] at org.netbeans.modules.project.ui.OpenProjectList.notifyClosed(OpenProjectList.java:1253)
	at org.netbeans.modules.project.ui.OpenProjectList.access$2500(OpenProjectList.java:137)
	at org.netbeans.modules.project.ui.OpenProjectList$10.run(OpenProjectList.java:922)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
Comment 1 Tomas Zezula 2013-07-08 17:15:01 UTC
The exception is caused by en existence of multiple instances of the JWSProjectOpenHook.
The projectOpened is called on different instance than the projectClosed which causes the ISE.
The problem is that the lookup result of a lookup created by Lookups.forPath() for a short while has no items (neither old ones nor new ones) in this time the DelegatingLookupImpl deletes the old map and in next run it recreates the object instances by calling createAdditionalLookup on LookupProviders.

The issue is a race, so it's not 100% reproduceable but it happens quite common with following steps:
1) Open IDE with ergonomics and empty user dir
2) Create a new J2SE Project (activates J2SE cluster)
3) Create a new Web Proejct (activates Web cluster)
4) Close the J2SE Project -> ISE is thrown
Comment 2 Tomas Zezula 2013-07-08 17:34:04 UTC
Added logging, jet-main c829fde0bf39

With following loggers enabled:

-J-Dorg.netbeans.modules.projectapi.LazyLookupProviders.level=FINE 
-J-Dorg.netbeans.spi.project.support.DelegatingLookupImpl.lel=FINE

you will see something like:

FINE [org.netbeans.spi.project.support.DelegatingLookupImpl]: New providers count: 43 for: 1,019,746,124
FINE [org.netbeans.spi.project.support.DelegatingLookupImpl]: New providers count: 0 for: 1,019,746,124
FINE [org.netbeans.spi.project.support.DelegatingLookupImpl]: New providers count: 43 for: 1,019,746,124

Followed by several Additional lookup created including additional lookup for JWSProjectOpenHook

FINE [org.netbeans.modules.projectapi.LazyLookupProviders]: Additional lookup created: 1,734,677,261 service class: org.netbeans.modules.javawebstart.JWSProjectOpenHook for base lookup: 1,048,594,742

when the web cluster is being enabled.
Comment 3 Tomas Zezula 2013-07-08 18:48:34 UTC
The issue can be "fixed" by an attached patch which caches the created additional Lookups.
However this is rather workaround and it would be better to fix the Lookups.forPath Lookup as the patch is sensitive to possible Lookup.equals() and similar problem may exist on different places.
Comment 4 Tomas Zezula 2013-07-08 18:49:37 UTC
Created attachment 136835 [details]
LazyLookupProviders.java diff
Comment 5 Tomas Zezula 2013-07-10 14:05:51 UTC
*** Bug 232516 has been marked as a duplicate of this bug. ***
Comment 6 Quality Engineering 2013-07-12 02:36:03 UTC
Integrated into 'main-silver', will be available in build *201307112300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/c829fde0bf39
User: Tomas Zezula <tzezula@netbeans.org>
Log: #232400: IllegalStateException from JWSProjectOpenHook - logging
Comment 7 Tomas Zezula 2013-07-18 07:59:56 UTC
*** Bug 232949 has been marked as a duplicate of this bug. ***
Comment 8 Jaroslav Tulach 2013-07-23 10:59:19 UTC
I have reproduced the problem.
Comment 9 Jaroslav Tulach 2013-07-24 08:58:05 UTC
Created attachment 137671 [details]
Reusing previous FolderLookup in RecognizeInstanceObjects seems to fix the problem
Comment 10 Martin Kanak 2013-07-24 13:33:47 UTC
Created attachment 137697 [details]
stacktrace

This exception appears during closing javaapplication (Git).

- select project root in Project view
- invoke popup menu via right-click and select "Close" => application is closed, but this exception appears
Comment 11 Tomas Zezula 2013-07-24 13:35:19 UTC
*** Bug 233320 has been marked as a duplicate of this bug. ***
Comment 12 Jaroslav Tulach 2013-07-25 10:09:11 UTC
I write a test and integrate the fix.
Comment 13 Jaroslav Tulach 2013-07-25 10:19:46 UTC
ergonomics#005f341dfc65
Comment 14 Milos Kleint 2013-07-25 10:43:48 UTC
*** Bug 230469 has been marked as a duplicate of this bug. ***
Comment 15 Quality Engineering 2013-08-08 02:30:59 UTC
Integrated into 'main-silver', will be available in build *201308072300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/005f341dfc65
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #232400: Reuse previous instance of FolderLookup rather than creating new on every change
Comment 16 Tomas Zezula 2013-08-19 18:56:50 UTC
*** Bug 234463 has been marked as a duplicate of this bug. ***
Comment 17 Tomas Zezula 2013-08-19 18:58:50 UTC
See issue #234463
Comment 18 Jaroslav Tulach 2013-08-20 12:50:24 UTC
What makes you believe bug 234463 is a duplicate? Does it involve enabling of modules? If not, it has some different cause.
Comment 19 Tomas Zezula 2013-08-20 13:58:00 UTC
The call to the POH is asymmetric -> several instances were created by the Lookup. It can be caused by Project's merged lookup, however previously the reason was this issue. Unfortunately I cannot find the messages.log in the exception report of the issue #234463 to prove it.
Comment 20 Jaroslav Tulach 2013-08-22 11:12:15 UTC
Well, without message log or without a way to reproduce the failure, there is nothing I can do. Marking fixed again.
Comment 21 Tomas Zezula 2013-09-17 11:58:33 UTC
*** Bug 235590 has been marked as a duplicate of this bug. ***