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 82914 - Hang in StatusDisplayer.getDefault
Summary: Hang in StatusDisplayer.getDefault
Status: CLOSED INVALID
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Petr Nejedly
URL:
Keywords: JDK_SPECIFIC, RANDOM
: 85174 85554 85984 115632 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-17 15:49 UTC by Jesse Glick
Modified: 2011-06-09 09:56 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dumps (25.07 KB, text/plain)
2006-08-17 15:49 UTC, Jesse Glick
Details
Native thread dump from gdb (16.70 KB, text/plain)
2006-09-26 13:06 UTC, twolf2919
Details
Wordpad with thread dump & screenshots (.rtf file) (5.25 MB, application/octet-stream)
2007-10-01 18:56 UTC, bthayer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2006-08-17 15:49:09 UTC
Mustang b95, 20060808 dev build. Sometimes NB hangs during startup, showing I
think "Initializing modules" or similar in the splash screen, and consuming 100%
CPU. Has to be killed. When I get thread dumps, it just shows

java.lang.IllegalMonitorStateException.<init>(IllegalMonitorStateException.java:31)
org.openide.awt.StatusDisplayer.getDefault(StatusDisplayer.java:53)

which does not make too much sense to me because this line of SD.java is just
returning a field; it is not waiting on anything. VM bug?
Comment 1 Jesse Glick 2006-08-17 15:49:27 UTC
Created attachment 33024 [details]
Thread dumps
Comment 2 Jesse Glick 2006-08-17 15:50:40 UTC
"Done loading modules" is I think the stage it gets to, not that it likely matters.
Comment 3 David Simonek 2006-08-17 16:19:41 UTC
Ccing experts, I'm just a poor UI guy ;-)
Comment 4 Jesse Glick 2006-08-17 16:58:28 UTC
Yes, again I suspect this is a JDK bug but I have no idea how to reproduce it or
where to look for more information. I have run into a similar hang a few times
in the past. I always run dev builds on Mustang. After killing and restarting NB
it starts up fine.

Note that the thread dumps span several minutes, during which nothing appears to
be happening; everything is inside the one Java line

  return INSTANCE;

which clearly is doing no locking. Presumably the actual bytecode being run is
monitorExit.

What is also weird: the thread dumps claim that the IllegalMonitorStateException
is blocked waiting for a monitor on itself in its own constructor, which does
not make a lot of sense.
Comment 5 Petr Nejedly 2006-08-21 12:16:28 UTC
Note: there's no actual monitorExit bytecode there, sychronized method is just
marked as such. The VM would still perform equivalent of monitorExit though.

The VM behaviour is really strange as captured in the dumps. You claim 100% cpu
usage, which is what would probably happen in case of wrong monitor{enter,exit}
pairing, because the code (when using synchonized block) looks like (pseudocode):

monitorEnter();
try {
   body();
} finally {
  retry:
  try {
    monitorExit();
  } catch (Throwable) {
    goto retry();
  }
}
i.e. the monitorExit bytecode is covered with the exception handler as well, so
when there is an exception during monitorExit (like the impossible IllegalMSE),
it would try to unlock again in a tight loop.

Comment 6 Jesse Glick 2006-09-21 00:58:47 UTC
*** Issue 85174 has been marked as a duplicate of this issue. ***
Comment 7 Jesse Glick 2006-09-21 01:00:15 UTC
More analysis in issue #85174.

VM team hints:

------

There is a very remote chance that this might be being caused by biased locking
- though I've only heard reports of IllegalMonitorStateException coming from 5.0
not 6.0 builds. Is this easily reproducible? Things I would try are:

1. Run with -XX:-UseBiasedLocking to disable biased locking
2. Run with a fastdebug build
   - see if any assertions fail
   - run  with -XX:+TraceExceptions to see where the IMSE originates

Can you establish whether the monitor actually appeared to have been locked? ie
can you tell if the code in the synchronized method is getting executed.
Comment 8 Jesse Glick 2006-09-21 01:02:33 UTC
And possible culprit (analysis pending):

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4414101
Comment 9 Jesse Glick 2006-09-21 17:49:59 UTC
pnejedly recommends diagnosis:

(gdb) thread apply all backtrace

Running with -XX:-UseBiasedLocking is not helpful since bug is not reproducible.
Running fastdebug with -XX:+TraceExceptions may be helpful in case the bug ever
occurs again.
Comment 10 Petr Nejedly 2006-09-24 19:35:36 UTC
*** Issue 85554 has been marked as a duplicate of this issue. ***
Comment 11 Petr Nejedly 2006-09-24 19:56:59 UTC
twolf2919 claims to be able to reproduce this from time to time.
Can you please:
1. Generate a native thread dump using gdb:
  gdb java <pid>
  (gdb) thread apply all backtrace
(make sure you have the tools/process ready in advance. It would be a pity to
miss such an opportunity because of missing/nonworking gdb)
2. Once you have the native thread dump, try running with -XX:-UseBiasedLocking
for few days. With your claimed probability of hitting the problem, we can be
quite sure it is biased-locking related if it doesn't happen to you for a week
or so with the flag.
Thanks.
Comment 12 Petr Nejedly 2006-09-24 19:58:16 UTC
Just a clarification note: -XX:-UseBiasedLocking is a JVM flag, so you need to
prefix it with -J when passing it to the NetBeans launcher.
Comment 13 Marian Mirilovic 2006-09-25 08:04:52 UTC
Increasing priority to P2 since one of the duplicate was P2 and alaso I think
such issues we have to take seriously.
Comment 14 twolf2919 2006-09-25 13:40:06 UTC
I will definitely do what you suggested as soon as it happens again.  But, just
so people don't get their hopes up too much: this morning, after reading this
thread, I started up netbeans - and it didn't hang!  This, after having gotten
stuck ever morning last week!  On the positive side, now at least I know what to
do the next time it happens.
Comment 15 twolf2919 2006-09-26 13:06:49 UTC
Created attachment 34507 [details]
Native thread dump from gdb
Comment 16 twolf2919 2006-09-26 13:12:46 UTC
I got it to hang again this morning - I attached the native thread dump as per
pnejedly's suggestion.  It appears the dump gets stuck in Thread 4.  Anyway,
next few times I will try to remember to run with -XX:-UseBiasedLocking,
although I'm not sure what to keep on the lookout for when I do that.
Comment 17 twolf2919 2006-09-29 14:06:54 UTC
I had to move to JDK b99 and a newer daily of NB6.0 - now I no longer see this
startup problem (before I was running b96.)  If I come across the problem again,
I'll, of course, let everyone know.  But, who knows, maybe it was JDK build
specific?
Comment 18 Jan Lahoda 2006-10-16 08:29:36 UTC
*** Issue 85984 has been marked as a duplicate of this issue. ***
Comment 19 Petr Nejedly 2006-10-31 12:30:50 UTC
JDK problem, apparently fixed in latest JDK6.0 betas.
Comment 20 Petr Nejedly 2007-09-19 15:52:10 UTC
*** Issue 115632 has been marked as a duplicate of this issue. ***
Comment 21 bthayer 2007-10-01 18:56:47 UTC
Created attachment 49925 [details]
Wordpad with thread dump & screenshots (.rtf file)
Comment 22 bthayer 2007-10-01 19:17:03 UTC
I just uploaded a .rtf file with a thread dump and screen shots. I wound up at this issue via issue number 8554 when 
researching why my Netbeans was hanging. I was suprised when I started Netbeans using nb.exe instead of the shortcut 
default netbeans.exe and after copying the thread dump the IDE opened. I got an error message (shown in the attachment) 
that there was a broken library reference. After fixing all of the broken references by creting new (empty) libraries 
it started fine. Note: it took me two tries because I only resolved broken references on one project when of course 
there were two different projects with different missing libraries.
Comment 23 Marian Mirilovic 2011-06-09 09:56:02 UTC
v/c