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 197837 - Deadlock when creating JavaCard projects
Summary: Deadlock when creating JavaCard projects
Status: VERIFIED FIXED
Alias: None
Product: javacard
Classification: Unclassified
Component: Java Card (show other bugs)
Version: 7.0
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords: REGRESSION
: 197998 198923 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-18 12:57 UTC by Tomas Hurka
Modified: 2011-06-01 10:06 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump (21.16 KB, text/plain)
2011-04-18 12:57 UTC, Tomas Hurka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Hurka 2011-04-18 12:57:32 UTC
Created attachment 107812 [details]
Thread dump

It is not possible to create any JavaCard project in NB 7.0. This is regression against NB 6.9.1. Steps to reproduce:
1) Download full NetBeans distribution. 
2) Install NetBeans and make sure that JavaCard is selected in installer.
3) Start NetBeans and go to File->New Project
4) Select JavaCard and 'Classic Applet Project'
5) Click 'Next', 'Next' and 'Finish'

project wizard never finish and stops at 67%. See attached thread dump for details.

Reproduced with:
Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Users\root\.netbeans\7.0
Comment 1 Adam Sotona 2011-05-11 09:20:31 UTC
*** Bug 197998 has been marked as a duplicate of this bug. ***
Comment 2 _ tboudreau 2011-05-11 09:34:49 UTC
Has nothing in particular to do with Javacard.

The culprit looks like it is the document lock, in use both by DataObject.createFromTemplate() via Freemarker, and the thread "org.openide.text Document Processing" which has noticed that the file has changed (probably due to createFromTemplate() also).

Any code which calls createFromTemplate() could trigger this problem.  Something affecting the timing or locking involved must have changed outside the javacard modules, since the javacard code did not change.

Reassigning.
Comment 3 Tomas Zezula 2011-05-11 14:17:10 UTC
>Has nothing in particular to do with Javacard.
Right, the problem is in simple.project.templates combined with fix of issue #173142.
The spt holds the Project's mutex (W) and creates data objects. The fix of #173142 causes that
DOs are formatted after they are created. The format requires editor lock.

The deadlock happens with a second thread which creates the syntax (JavaKit.createSyntax),
it's called under editor lock. The syntax creation calls SourceLevelQuery which requires Project's mutex (R).

The fix changes locking in the spt. The Project's mutex is taken only during writing of project's metadata.
It's not needed as 1st) the project does not exist yet and it's called under FS.runAA. 2nd) Source files are not project metadata - no project mutex in write mode is needed.

In addition to this fix, the deadlock with java syntax is solved by removing the java syntax. But any other syntax may call some other project query.
Comment 4 Tomas Zezula 2011-05-11 15:27:28 UTC
Fixed jet-main b8131966ea08
Comment 5 Quality Engineering 2011-05-12 04:38:05 UTC
Integrated into 'main-golden', will be available in build *201105120000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b8131966ea08
User: Tomas Zezula <tzezula@netbeans.org>
Log: #197837:Deadlock when creating JavaCard projects
Comment 6 Tomas Zezula 2011-05-12 05:24:28 UTC
I;va also guarded the ProjectXmlCreator. The project mutex is not needed as the created project does not escape before it's fully created, but for sure.
jet-main a788a2a82854
Comment 7 Quality Engineering 2011-05-13 05:55:42 UTC
Integrated into 'main-golden', will be available in build *201105130000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a788a2a82854
User: Tomas Zezula <tzezula@netbeans.org>
Log: #197837:Deadlock when creating JavaCard projects
Comment 8 Jaromir Uhrik 2011-05-16 14:52:24 UTC
Verified in the following trunk build, I agree with integration to patch1:
Product Version: NetBeans IDE Dev (Build 201105160400)
Java: 1.6.0_25; Java HotSpot(TM) Client VM 20.0-b11
System: Windows 7 version 6.1 running on x86; Cp1250; cs_CZ (nb)
Comment 9 Tomas Zezula 2011-05-16 15:42:31 UTC
"For the list of included fixed bugs please check http://wiki.netbeans.org/NetBeans70PatchesInfo"
Comment 11 Jaromir Uhrik 2011-05-19 13:59:14 UTC
Verified in the following build + patch1:
Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_25; Java HotSpot(TM) Client VM 20.0-b11
System: Windows 7 version 6.1 running on x86; Cp1250; cs_CZ (nb)
Comment 12 Anton Chechel 2011-06-01 10:06:02 UTC
*** Bug 198923 has been marked as a duplicate of this bug. ***