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 229648 - IDE locked when creating web service client
Summary: IDE locked when creating web service client
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-13 11:05 UTC by Jiri Skrivanek
Modified: 2013-05-21 13:23 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump. (30.48 KB, text/plain)
2013-05-13 11:05 UTC, Jiri Skrivanek
Details
Thread dump from Windows XP. (33.28 KB, text/plain)
2013-05-13 11:13 UTC, Jiri Skrivanek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2013-05-13 11:05:44 UTC
Created attachment 134354 [details]
Thread dump.

The IDE was locked while automated test was creating web service client in EJB EE6 project. So far I am not sure it is random or reproducible failure.

Product Version = NetBeans IDE 7.3.1 (Build javaee7-301-on-20130510) (#5c7cb9e7d72c)
Operating System        = Windows 7 version 6.1 running on x86
Java; VM; Vendor        = 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01; Oracle Corporation
Runtime                 = Java(TM) SE Runtime Environment 1.7.0_21-b11
Comment 1 Jiri Skrivanek 2013-05-13 11:13:12 UTC
Created attachment 134355 [details]
Thread dump from Windows XP.

It seems to be reproducible at least in automated tests. Attached is another thread dump from Windows XP (stack traces almost the same).
Comment 2 David Konecny 2013-05-13 20:36:40 UTC
The deadlock is between those two threads:

"org.netbeans.spi.project.ui.support.NodeFactorySupport" thread holds openide.nodes lock and updates some children nodes which in turn calls EJB Project's EjbsNodeFactory which calls EJB Metadata model which in turn calls parsing.api.ParserManager.parseWhenScanFinished.

"Editor Parsing Loop (javaee7-301-on-20130510)" thread is calling java.navigation.BreadCrumbsScanningTask which needs to access nodes which are locked.

I've seen the exactly same deadlock very recently. It was BreadCrumbsScanningTask against some other code updating nodes. I was able to workaround that case but this one I'm not sure. It's an existing code which was written this way for years. I wonder whether it could be solved on BreadCrumbsScanningTask side by doing nodes access outside of "Editor Parsing Loop" thread?

What do you think Honza?
Comment 3 David Konecny 2013-05-13 20:37:39 UTC
Assigning to lahvac as author of BreadCrumbsScanningTask.
Comment 4 Jan Lahoda 2013-05-14 16:17:51 UTC
Hm, I guess it is time to call off the experiment to convert the Java AST directly into the Nodes, and use an intermediate representation:
http://hg.netbeans.org/jet-main/rev/637e74096694
Comment 5 Jiri Skrivanek 2013-05-15 08:29:13 UTC
Is the patch applicable for NB7.3.1? Somehow it should be fixed in 7.3.1.
Comment 6 Jan Lahoda 2013-05-15 08:41:08 UTC
(In reply to comment #5)
> Is the patch applicable for NB7.3.1? Somehow it should be fixed in 7.3.1.

Technically, I am able to backport it, as long as it can be verified and tested to both fix the problem and be safe.
Comment 7 Jiri Skrivanek 2013-05-15 08:48:50 UTC
If this change affects BreadCrumbs feature in general I am not able to cover all possible test cases. I can just verify the original Java EE test case and run tests. If you feel your change needs thorough testing, I prefer some isolated hotfix in 7.3.1.
Comment 8 Jan Lahoda 2013-05-15 09:31:22 UTC
(In reply to comment #7)
> If this change affects BreadCrumbs feature in general I am not able to cover
> all possible test cases. I can just verify the original Java EE test case and
> run tests. If you feel your change needs thorough testing, I prefer some

It surely needs good testing.

> isolated hotfix in 7.3.1.

Unfortunately, I don't see a safe fix in java.navigation. But suggestions on one are welcome.
Comment 9 David Konecny 2013-05-16 03:12:05 UTC
The current deadlock is just one manifestation of a problem which can happen in many places. See issue 229415 which illustrates this problem with maven.jaxws.actions.AddOperationAction. So even if I somehow workaround this issue too it is likley the Breadcrumb will bite us somewhere else - most of EE modules are using the same pattern of calling metamodel which can result into parsing.

Having said I can see that EjbContainerChildren is a bit too eager in attaching listener in its constructor - that could be postponed little bit and done in addNotify which may workaround this deadlock. I will try that.
Comment 10 David Konecny 2013-05-16 03:48:39 UTC
I pushed alternative fix: e40617d963be
That should fix the problem on the EJB module side. You may have to revert Honza's fix locally to test it. The fix is simple and should be save.
Comment 11 Jiri Skrivanek 2013-05-16 18:38:37 UTC
I built 7.3.1 with patch e40617d963be and tests passed without locking. I prefer to put just changeset e40617d963be into release73.
Comment 12 David Konecny 2013-05-16 21:26:46 UTC
Martin, could you review please http://hg.netbeans.org/web-main/rev/e40617d963be ? Thanks.
Comment 13 Martin Fousek 2013-05-17 06:02:37 UTC
(In reply to comment #12)
> Martin, could you review please
> http://hg.netbeans.org/web-main/rev/e40617d963be ? Thanks.

Sure. The patch seems to be ok.
Comment 14 Martin Fousek 2013-05-17 06:19:08 UTC
BTW, thanks for the fix into EjbContainerChildren.
Comment 15 Quality Engineering 2013-05-17 09:53:06 UTC
Integrated into 'main-golden', will be available in build *201305170640* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/e40617d963be
User: David Konecny <dkonecny@netbeans.org>
Log: #229648 - IDE locked when creating web service client - alternative fix in EJB module
Comment 16 Quality Engineering 2013-05-18 02:54:27 UTC
Integrated into 'main-golden', will be available in build *201305172300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/637e74096694
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #229648: creating intermediate model between Java AST and Nodes, to prevent accessing Nodes locks under the parsing lock.
Comment 17 David Konecny 2013-05-19 20:55:05 UTC
Transplanted into release73 branch as 1b5baae72474
Comment 18 Quality Engineering 2013-05-21 00:21:03 UTC
Integrated into 'releases', will be available in build *201305202200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/1b5baae72474
User: David Konecny <dkonecny@netbeans.org>
Log: #229648 - IDE locked when creating web service client - alternative fix in EJB module
(transplanted from e40617d963be9460ed32bcd7ef00dc5803422ec2)