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 197404

Summary: deadlock involving annotations and hints
Product: editor Reporter: err <err>
Component: Parsing & IndexingAssignee: Tomas Zezula <tzezula>
Status: VERIFIED FIXED    
Severity: normal CC: mmirilovic, tzezula
Priority: P1    
Version: 7.0   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: thread dump of deadlock

Description err 2011-04-04 15:42:30 UTC
Created attachment 107479 [details]
thread dump of deadlock

I entered Ctrl-space, got the searching/waiting... one line popup. Didn't go away. ESC dismissed. Tried again, still wouldn't complete. Decided to save file and exit IDE. hang. Set to P2 since edits were lost.

The following can be seen in the attached thread dump


Found one Java-level deadlock:
=============================
"AnnotationHolder":
  waiting to lock monitor 0x0ba996cc (object 0x19d31620, a org.netbeans.modules.parsing.impl.TaskProcessor$InternalLock),
  which is held by "OpenIDE-request-processor-4"
"OpenIDE-request-processor-4":
  waiting to lock monitor 0x047205f4 (object 0x16db1290, a org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList),
  which is held by "AnnotationHolder"


Product Version: NetBeans IDE 7.0 RC1 (Build 201103280000)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\erra\.netbeans\7.0rc1
Comment 1 Marian Mirilovic 2011-04-04 20:38:15 UTC
nice ;(

Editor guys, please evaluate ASAP.
Comment 2 Jan Lahoda 2011-04-05 02:41:42 UTC
I think I can easily remove the lock that wraps the JavaSourceTaskFactory.reschedule which would most likely fix the problem. The question is whether this is the correct fix.
Comment 3 Tomas Zezula 2011-04-05 11:40:23 UTC
It may be problem even with other tasks. I am fixing it in TP.
Comment 4 Tomas Zezula 2011-04-05 12:58:16 UTC
Fixed jet-main 1b4a3c298ee8
Comment 5 Jan Lahoda 2011-04-05 13:45:06 UTC
Seems fine to me.
Comment 6 Tomas Zezula 2011-04-05 15:16:58 UTC
Integrated into 7.0 http://hg.netbeans.org/releases/rev/cc774d65701f
Comment 7 Jaroslav Tulach 2011-04-05 15:31:28 UTC
There is a way to check if a lock is being held: Thread.holdsLock. Thus:
1. adding new boolean parameter is not necessary, could be replaced with holdsLock call
2. you should add assertFalse(Thread.holdsLock(INTERNAL_LOCK)) into some of your tests, so they fail before your fix and pass now.
Those are my 2Kč. They probably do not influence your fix for 7.0, but at least one could be useful in long term.
Comment 8 Tomas Zezula 2011-04-05 15:37:02 UTC
For trunk I am planing a bit complex rewrite. But thanks Jardo anyway.
Comment 9 Quality Engineering 2011-04-06 08:45:27 UTC
Integrated into 'main-golden', will be available in build *201104060400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1b4a3c298ee8
User: Tomas Zezula <tzezula@netbeans.org>
Log: #197404:deadlock involving annotations and hints
Comment 10 Jaromir Uhrik 2011-04-08 09:24:02 UTC
No regression met during testing so marking this issue as Verified.