United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7184401 JDk7u6 : Missing main menu bar in Netbeans after fix for 7162144
JDK-7184401 : JDk7u6 : Missing main menu bar in Netbeans after fix for 7162144

Details
Type:
Bug
Submit Date:
2012-07-16
Status:
Closed
Updated Date:
2012-08-06
Project Name:
JDK
Resolved Date:
2012-08-06
Component:
client-libs
OS:
generic
Sub-Component:
java.awt
CPU:
generic
Priority:
P1
Resolution:
Fixed
Affected Versions:
7u6
Fixed Versions:
7u6 (b22)

Related Reports
Relates:
Relates:

Sub Tasks

Description
After the fix for "7162144: Missing AWT thread in headless mode in 7u4 b06"
which is pushed inyo 7u6, I find that netbeans comes up with a completely
empty main menu bar.
I reverted this fix and the menu bar came back .. I repeated this
again to make sure and it does seem to be 100% reproducible.

I didn't see it with SwingSet, so undoubtedly its something netbeans
is doing that makes it an issue but I expect this is still a stopper.

The fix for 7162144 is presently in the 7u6 repo, but is not yet in any
nightly build (I don't know why nightly builds aren't happening, but they aren't),
so you need to create your own build to see this.
If this isn't fixed before then the problem will appear in 7u6 b21.

I also can't test it on JDK 8 since it doesn't appear to be fixed in JDK 8
yet, although I thought all bugs were supposed to be fixed in 8 first.

                                    

Comments
EVALUATION

According to the stack trace, NetBeans calls Thread.interrupt() for AWT event dispatch thread several times on startup. I can't see any obvious reasons for that. What's even more interestingly, these calls are done from the same thread (EDT).

Now it's clear why the fix 7162144 is related. In this fix, we changed the way how EventDispatchThread interrupts are handled. Instead of just shutting down the thread, we now additionally discard all the queued events, so pending invokeAndWait() calls are unblocked. This allowed NetBeans test suite to run (which is exactly the problem described in 7162144). It seems that one of the discarded invokeAndWait()'s is the code to initialize NetBeans menubar.
                                     
2012-07-17
EVALUATION

The NetBeans AWTTask.EDT class calls Thread.interrupt() for its own purposes and properly makes sure the isInterrupted() status is cleared before the code returns back to AWT code. However, since revision 

d72ac458b2b7 - anthony 26.9.2011
7081670: Disposing an AppContext can lead to a spinning EventDispatchThread
Reviewed-by: art, anthony, dholmes
Contributed-by: Clemens Eisserer <###@###.###>

The EventDispatchThread overrides the interrupt() method and premanently sets the "shutdown" flag to "true" which then shuts down the thread for no reason.
                                     
2012-07-18
EVALUATION

Whether EDT.interrupt() can be used by applications for their own purposes is a separate topic to discuss. In 7u6, however, the only safe solution is to roll-back the fix for 7162144. Applying additional changes on top of 7162144 is too risky.
                                     
2012-07-19
SUGGESTED FIX

Roll-back the fix for 7162144.
                                     
2012-07-19
SUGGESTED FIX

http://hg.openjdk.java.net/jdk7u/jdk7u6-dev/jdk/rev/bf941141d1bf
                                     
2012-07-20
EVALUATION

Verified
                                     
2012-08-06



Hardware and Software, Engineered to Work Together