[ 
https://issues.apache.org/jira/browse/NETBEANS-4696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17189022#comment-17189022
 ] 

Tomas Zezula commented on NETBEANS-4696:
----------------------------------------

[~jtulach]

>Parsing API doesn't really hold a "lock", but it only runs in a single 
>dedicated thread (which is a shared, spare resource too).

There are two kinds of actions. The first are the event based tasks scheduled 
by schedulers. These run in the dedicated thread as you described. But there 
are also user action task which are executed in the caller thread. They are 
mutually exclusive to other user action tasks and scheduler tasks. The deadlock 
is caused by a user action task which holds a global lock to exclude other 
tasks.

Also Java indexing creates a separate compiler \{JavaCustomIndexer} which does 
not take this lock and run concurrently to the above tasks. For tasks the lock 
cannot be removed as the parsers are not thread safe (parsers and parser 
results are shared).

Looking at the stack trace the deadlock is not caused by indexing but by brace 
matching ("EditorBracesMatching" #15 daemon prio=1) which waits until the 
projects are loaded.

 
{code:java}

        - waiting to re-lock in wait() <0x000000008718a120> (a 
org.openide.util.RequestProcessor$Task)
        at 
org.openide.util.RequestProcessor$Task.waitFinished(RequestProcessor.java:1672)
        at 
org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.get(OpenProjectList.java:576)
        at 
org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.get(OpenProjectList.java:320)
        at 
org.netbeans.modules.javascript2.knockout.index.KnockoutIndex.get(KnockoutIndex.java:60)
        - locked <0x000000008e4c2988> (a java.util.WeakHashMap)
        at 
org.netbeans.modules.html.knockout.KOHtmlExtension.isTagCustomKnockoutElement(KOHtmlExtension.java:395)
        at 
org.netbeans.modules.html.knockout.KOHtmlExtension.isCustomTag(KOHtmlExtension.java:302){code}
 

There are two possible fixes.

Probably both should be done.

1st) There should be \{KnockoutIndex.getIfExists} and the KOHtmlExtension 
should not wait for the index. It should just return no tags. It's much better 
than holding the global lock for a long time. The project loading is long 
running task.

2nd) The second thread in the deadlock is parsing module name. As far as I 
remember I did some utilities doing module name parsing which were lock free. 
Maybe we need to more to update the the \{UnitTestsCompilerOptionsQueryImpl} to 
use them or add a needed version.

> NetBeans 12.1-beta1 sometimes hangs on open
> -------------------------------------------
>
>                 Key: NETBEANS-4696
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-4696
>             Project: NetBeans
>          Issue Type: Bug
>          Components: ide - Performance
>    Affects Versions: 12.1
>         Environment: Linux (Debian "Buster")
> OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
>            Reporter: Glenn Holmer
>            Priority: Major
>         Attachments: 12.1-vc1-thread-dump-orac.txt, 
> nb12.1-beta1-thread-dump.png, nb12.1-beta1-thread-dump.txt, 
> netbeans-12.1-thread-dump.txt
>
>
>  
> NetBeans sometimes hangs on startup; the symptom is a stalled "Opening 
> Projects" progress bar. I haven't been able to find a repro case, but I'm 
> attaching a thread dump (from VisualVM) and screen shot.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to