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 93076

Summary: Debugging JComboBox with Java 6 kills X input.
Product: debugger Reporter: dustin_mccartney <dustin_mccartney>
Component: CodeAssignee: Martin Entlicher <mentlicher>
Status: RESOLVED FIXED    
Severity: blocker CC: ilantal, jsnel, misterm, mrs_sheep, pbowyer, sc1
Priority: P1    
Version: 5.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description dustin_mccartney 2007-01-24 00:15:42 UTC
ISSUE
Debugging JComboBox's in a Java 6 application are very difficult because the
debugger kills all X input.  Only way to recover is by rebooting or pressing
Ctrl-Alt-Backspace to restart X.

REPRODUCIBILITY
ALWAYS OCCURS with J2SE 6 JDK.  DOES NOT occur with J2SE 5 JDK.  This ALWAYS
reproduces on 3 different machines: 1) Ubuntu 6.10 running GNOME 2.16.1; 2)
openSuSE 10.2 GNOME 2.16.1; 3) openSuSE 10.2 KDE (the default version of KDE for
openSuSE 10.2).  The fact that it occurs on KDE as well leads me to believe this
bug occurs with J2SE 6 debugging and X rather than a specific window manager.

I am not sure if this is a J2SE 6 bug or Netbeans 5.5 debugger running J2SE 6 bug.

STEPS TO REPRODUCE
1) Compile the following program (Netbeans comments/tags stripped for brevity):
[CODE]
public class ComboCrash extends javax.swing.JFrame
{
    public ComboCrash()
    {
        initComponents();
    }
    private void initComponents()
    {
        cboCrash = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        cboCrash.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
"Item 1", "Item 2", "Item 3", "Item 4" }));
        cboCrash.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cboCrashActionPerformed(evt);
            }
        });

        getContentPane().add(cboCrash, java.awt.BorderLayout.CENTER);

        pack();
    }

    private void cboCrashActionPerformed(java.awt.event.ActionEvent evt)
    {
        int PLACE_BREAK_POINT_HERE_TO_DEADLOCK_X11 = 0;
    }
    
    private javax.swing.JComboBox cboCrash;
}
[/CODE]

2) Place a breakpoint inside the "cboCrashActionPerformed" method on the
"PLACE_BREAK_POINT_HERE_TO_DEADLOCK_X11" line.

3) Compile & Run

4) Change the ComboBox entry to hit the breakpoint.

5) Netbeans 5.5 shows the break-point being hit, but input to X is dead... 
Keyboard input is ignored, Mouse clicks are ignored, etc.  The mouse cursor can
be moved and applications seem to continue running (the GNOME System Monitor
still updates as well as any music I am playing in the background.), although I
can't interact with any of them.
Comment 1 Martin Entlicher 2007-01-24 14:26:52 UTC
This is not NetBeans bug. I've reproduced this with jdb. It's true that on JDK
1.5 it works fine, but on JDK 1.6 it blocks X server. To resurrect from this
state it's enough to switch to console (CTRL-ALT-F1), kill the Java app and
switch back (CTRL-ALT-F7).

I'll file an issue for JDK...
Resolving as invalid - not a NetBeans bug.
Comment 2 Martin Entlicher 2007-01-24 15:55:15 UTC
I've submitted a defect #6517045 for JDK.
Comment 3 Martin Entlicher 2007-08-13 09:53:33 UTC
*** Issue 112589 has been marked as a duplicate of this issue. ***
Comment 4 Martin Entlicher 2007-08-16 13:37:38 UTC
Reopening, should not be invalid, but wontfix.
Comment 5 Martin Entlicher 2007-08-16 13:38:09 UTC
Wontfix
Comment 6 Martin Entlicher 2007-08-16 13:39:28 UTC
*** Issue 91602 has been marked as a duplicate of this issue. ***
Comment 7 Martin Entlicher 2007-08-16 13:41:37 UTC
*** Issue 112977 has been marked as a duplicate of this issue. ***
Comment 8 Martin Entlicher 2008-07-24 14:23:22 UTC
*** Issue 141428 has been marked as a duplicate of this issue. ***
Comment 9 Peter Pis 2008-08-27 10:22:38 UTC
*** Issue 145263 has been marked as a duplicate of this issue. ***
Comment 10 Martin Entlicher 2009-04-02 09:15:30 UTC
*** Issue 161715 has been marked as a duplicate of this issue. ***
Comment 11 Martin Entlicher 2009-06-16 12:49:13 UTC
*** Issue 167156 has been marked as a duplicate of this issue. ***
Comment 12 jbfaden 2009-06-16 13:13:48 UTC
My work-around is to switch to a different virtual console in gnome using Cntl-Alt-F1, then kill the java process I'm
debugging.  Then at least you don't have to restart the X server and you don't loose your place in Netbeans.  

Is it possible to make my default platform java 5 (for debugging) but still run Netbeans under java 6?  
Comment 13 Martin Entlicher 2009-06-16 13:36:05 UTC
Yes, you can add JDK 5 into the Java Platforms (Tools -> Java Platforms) and then set the project you're debugging to
use that JDK 5.

You can also have a look at http://wingware.com/doc/howtos/debug-x-grab
Specifically, under (2):
Setting option "AllowDeactivateGrabs" "true" in xorg.conf.
Comment 14 Martin Entlicher 2009-07-21 15:22:00 UTC
*** Issue 168572 has been marked as a duplicate of this issue. ***
Comment 15 Martin Entlicher 2009-09-21 12:51:59 UTC
*** Issue 172531 has been marked as a duplicate of this issue. ***
Comment 16 Martin Entlicher 2009-10-12 10:52:51 UTC
*** Issue 174291 has been marked as a duplicate of this issue. ***
Comment 17 Martin Entlicher 2009-12-16 07:45:03 UTC
*** Bug 178685 has been marked as a duplicate of this bug. ***
Comment 18 Martin Entlicher 2010-02-15 03:45:42 UTC
*** Bug 180714 has been marked as a duplicate of this bug. ***
Comment 19 Quality Engineering 2010-04-29 09:31:55 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.
Comment 20 misterm 2010-04-29 18:10:15 UTC
*** Bug 185263 has been marked as a duplicate of this bug. ***
Comment 21 Martin Entlicher 2010-11-24 21:47:22 UTC
*** Bug 192425 has been marked as a duplicate of this bug. ***
Comment 22 Martin Entlicher 2011-01-31 15:49:07 UTC
*** Bug 194839 has been marked as a duplicate of this bug. ***
Comment 23 Martin Entlicher 2011-01-31 15:52:50 UTC
Just for reference, as an easy workaround, this property prevent from the GUI freeze when set to the program being debugged:
-Dsun.awt.disablegrab=true
As a side-effect some pop-up menus might not be closed, so use it for the debugging only.
Comment 24 Martin Entlicher 2011-03-30 09:36:40 UTC
*** Bug 197220 has been marked as a duplicate of this bug. ***
Comment 25 Martin Entlicher 2011-10-19 13:11:06 UTC
*** Bug 203221 has been marked as a duplicate of this bug. ***
Comment 26 Martin Entlicher 2011-10-19 13:16:48 UTC
As I've mentioned in issue #203221, I've managed to hack into X11 code and find a solution to this problem of locked X server. It's possible to release the window grab via debugger. That allows debugging of the JComboBox.

Fixed by changeset:   204876:5aa81c3749e4
http://hg.netbeans.org/main/rev/5aa81c3749e4
Comment 27 Quality Engineering 2011-10-20 14:30:57 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/5aa81c3749e4
User: mentlicher@netbeans.org
Log: #93076, #203221 Detection of paused threads of applications that holds grabbed window implemented via direct access to X serevr routines. The grab is either released, or application is resumed to prevent from frozen X server.