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 172115 - AWT thread blocked for 30839 ms.
Summary: AWT thread blocked for 30839 ms.
Status: NEW
Alias: None
Product: contrib
Classification: Unclassified
Component: JMX (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: Jean-francois Denise
URL: http://statistics.netbeans.org/except...
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2009-09-13 20:33 UTC by jfarjona
Modified: 2013-06-04 17:19 UTC (History)
38 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 158405


Attachments
nps snapshot (47.68 KB, bin/nps)
2009-09-13 20:33 UTC, jfarjona
Details
nps snapshot (256.00 KB, application/nps)
2009-12-09 01:09 UTC, Peter Nabbefeld
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jfarjona 2009-09-13 20:33:06 UTC
Build: NetBeans IDE Dev (Build 200908022240)
VM: Java HotSpot(TM) Client VM, 14.0-b16, Java(TM) SE Runtime Environment, 1.6.0_14-b08
OS: Windows Vista, 6.0, x86

User Comments:
jfarjona: Changed the signature of a function in another object.  Seems that it gets stuck re-building internally ?


Maximum slowness yet reported was 30839 ms, average is 30839
Comment 1 jfarjona 2009-09-13 20:33:12 UTC
Created attachment 87567 [details]
nps snapshot
Comment 2 David Strupl 2009-09-14 16:18:08 UTC
J2EE please check why this happens and whether something is wrong on your side or ours.
Comment 3 Petr Jiricka 2009-09-15 16:06:31 UTC
Not in j2ee, this looks related to jmx module, which is on the update center.
Comment 4 Jean-francois Denise 2009-09-15 17:59:56 UTC
Hi, could you provide a bit of context. How to use an nps snapshot? Where the time is spent?
Thanks.
Comment 5 Tomas Pavek 2009-09-16 13:02:12 UTC
Just open the nps snapshot in NetBeans (menu Profile | Load Snapshot). See also
http://wiki.netbeans.org/FitnessViaPostMortem

As for this particular snapshot, it looks like not much time is spent in AWT Event Queue thread, but it's because it is
waiting. This snapshot is still in the older format where it is more difficult to find out what a thread is waiting for.

When you have the snapshot opened, expand AWT-EventQueue-1 thread, then scroll down and on the last expanded node invoke
"Show Subtree" from context menu. In the subtree view press Ctrl+F and search for Unsafe.park. Then you'll see that the
AddAttrAction when being enabled causes java source parsing - which is the problem, parsing should be run in AWT thread,
especially not for things like enabling actions that must be really fast. 
Comment 6 Jean-francois Denise 2009-09-16 13:38:12 UTC
Thanks, I can see the stack.
You say that parsing should be run in AWT thread, I guess that you mean should not. Right? 
In order to enable or not these actions we need to do this parsing. So we need some way to wait until this parsing is done before to return from enable() 
method. What is the right way to achieve this.
Thanks.
JF

Comment 7 Tomas Pavek 2009-09-16 14:17:04 UTC
Yes, parsing should *not* run in AWT thread, it was a typo.

As for how to do this correctly, it is not that easy. Basically when you identify that you need to check the action
enabling, you should do it in a separate (background) thread and set the action state when it completes. This means that
until you know, the action should look like enabled and if someone invokes it too early then you need to wait for the
task to finish. So it may happen the user clicks an action that in fact should be disabled (it is just not known yet) -
in such case you'd have to tell the user. But the cases when this runs for long time should be limited, probably only
when it waits for initial scan of sources or an up-to-date check. But as you can see from this report, sometimes it can
be quite long, so it should definitely not block entire application - just because some action needs to determine if it
is enabled or not.

Another option is to think if there is not some other way to determine if the class is MBean that would not require java
source infrastructure (I'm not able to tell).
Comment 8 Peter Nabbefeld 2009-12-09 01:09:32 UTC
Created attachment 92317 [details]
nps snapshot