-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
x86
-
windows_nt
(note: the DUAL-processor config may be significant)
Name: rlT66838 Date: 12/17/99
There is a huge performance regression seen in the initial
posting of a JMenu's popup menu if the menu items include icons
that are disabled. In 1.2.2 the menu is posted (and filled)
instantaneously, but in 1.3beta the posting/filling takes
roughly 5secs on my dual 300MHz NT4 system. The testcase below
was written so the menu items are disabled by default, but if you
include any command line arguments at all then the menu items
will not be disabled (makes it easy to compare performance of
enabled vs disabled items).
If the popup happens to be a heavyweight due to the size of the
initial frame then the popup is posted immediately it just won't
have any contents until that initial 5second delay is over.
Be sure to change the location of where the SwingSet images
directory is in the test code below.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class popupWithDisabledIconsBug extends JFrame {
// just use images from SwingSet
static final String IMAGES = "d:/jdk1.3beta/demo/jfc/SwingSet/images/";
static final String[] NAMES = {"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};
public popupWithDisabledIconsBug(boolean disable) {
JMenuBar menuBar;
JMenu menu;
JMenuItem menuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
menu = new JMenu("Test");
menu.setMnemonic('T');
menuBar.add(menu);
for (int i=0; i<NAMES.length; i++) {
menuItem = new JMenuItem("New Item #"+i);
menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
if (disable)
menuItem.setEnabled(false);
menu.add(menuItem);
}
}
public static void main(String[] args) {
popupWithDisabledIconsBug window = new popupWithDisabledIconsBug((args.length == 0));
window.setTitle("Popup w/ Disabled Icons Bug");
// set size so popup has to be a heavyweight
window.setSize(100, 200);
window.setVisible(true);
}
}
(Review ID: 94374)
======================================================================
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-I)
Java HotSpot(TM) Client VM (build 1.3-I, mixed mode)
Please note that I have already filed a bug report that has been entered
into the system as 4300430. The reason I'm entering a new bug report is that
4300430 only talks about a problem that showed up in 1.3beta where a large
slowdown in performance is seen. In 1.3ra this bug has turned into a hang
of the VM! I really need for someone to either confirm that this isn't a
problem in the latest engineering Kestrel build or to figure out a suitable
workaround if this won't get fixed for Kestrel. The person who evaluated the
original 4300430 but report was Roger Lewis.
Here's the problem in a nutshell. If a popup menu contains disabled icons
then the first time it's posted the VM can hang. Note that the hang _may_
not happen every time but my experience with this bug is that it happens
more often than not. Also note that the problem seems to be limited to
multiprocessor machines(I've got a dual processor NT system). I've also seen
the bug when toolbar buttons contain images that start off disabled. Here's
a simple testcase that has been used for bug report 4300430 that seems to
reproduce the problem. Once invoked, just click on the "Test" menubar button
to post the menu. If it comes up right away then reinvoke and try again.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class popupWithDisabledIconsBug extends JFrame {
// just use images from SwingSet
static final String IMAGES = "d:/jdk1.3ra/demo/jfc/SwingSet/images/";
static final String[] NAMES =
{"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};
public popupWithDisabledIconsBug(boolean disable) {
JMenuBar menuBar;
JMenu menu;
JMenuItem menuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
menu = new JMenu("Test");
menu.setMnemonic('T');
menuBar.add(menu);
for (int i=0; i<NAMES.length; i++) {
menuItem = new JMenuItem("New Item #"+i);
menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
if (disable)
menuItem.setEnabled(false);
menu.add(menuItem);
}
}
public static void main(String[] args) {
popupWithDisabledIconsBug window = new
popupWithDisabledIconsBug((args.length == 0));
window.setTitle("Popup w/ Disabled Icons Bug");
// set size so popup has to be a heavyweight
window.setSize(100, 200);
window.setVisible(true);
}
}
(Review ID: 100314)
======================================================================
Name: krT82822 Date: 04/02/2000
4/2/2000, eval1127@eng -- this was NOT reproducible with kestrel-rc2 (1.3.0rc2-Y) on a UNIPROCESSOR NT box.
However, as the user notes, this may be multi-processor-specific.
java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
I've been trying to get your guys attention for a long time about this issue.
Initially in 1.3beta the problem involved terribly long times to post menus that
had disabled images for the menu items. Then in 1.3RA the problem changed into a
full fledged hanging of the VM! The hang is still present in 1.3rc1 and
I'm afraid it will also be there in the upcoming official release of 1.3. Please
"same as" bug 4300430 to this new report since this one specifically talks about
the hang.
The test app that I've included below easily shows this rather devastating
problem. Unfortunately it may be that the problem is limited to multi-processor
NT machines(which is all that my company uses). Also the test app may need to be
run several times before you get a VM hang(I've always gotten it to happen in
under 5 trys).
Here is where the VM is hanging, as gotten by hitting Ctrl-C in the invoking
shell:
"AWT-EventQueue-0" prio=7 tid=0x784e10 nid=0xb0 waiting on monitor
[0x93df000..0x93dfdc8]
at java.lang.Object.wait(Native Method)
at java.awt.MediaTracker.waitForID(MediaTracker.java:632)
at javax.swing.ImageIcon.loadImage(ImageIcon.java:226)
at javax.swing.ImageIcon.<init>(ImageIcon.java:161)
at javax.swing.AbstractButton.getDisabledIcon(AbstractButton.java:542)
at
javax.swing.plaf.basic.BasicMenuItemUI.paintMenuItem(BasicMenuItemUI.java:561)
at
javax.swing.plaf.basic.BasicMenuItemUI.paint(BasicMenuItemUI.java:473)
at
javax.swing.plaf.basic.BasicMenuItemUI.update(BasicMenuItemUI.java:469)
at javax.swing.JComponent.paintComponent(JComponent.java:398)
at javax.swing.JComponent.paint(JComponent.java:739)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:546)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:719)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:23)
at
sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:54)
at
sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91)
at java.awt.Container.paint(Container.java:959)
at sun.awt.RepaintArea.paint(RepaintArea.java:298)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:193)
at java.awt.Component.dispatchEventImpl(Component.java:2665)
at java.awt.Container.dispatchEventImpl(Container.java:1212)
at java.awt.Window.dispatchEventImpl(Window.java:912)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
Here's the code (invoke w/ any arg to use non-disabled menu items):
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DisabledImageHang extends JFrame {
// ###
// ### UPDATE THE FOLLOWING PATH FOR YOUR SYSTEM
// ###
static final String IMAGES = "d:/jdk1.3rc1/demo/jfc/Notepad/resources/";
static final String[] NAMES =
{"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};
public DisabledImageHang(boolean disable) {
JMenuBar menuBar;
JMenu menu;
JMenuItem menuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
menu = new JMenu("Test");
menu.setMnemonic('T');
menuBar.add(menu);
for (int i=0; i<NAMES.length; i++) {
menuItem = new JMenuItem("New Item #"+i);
menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
if (disable)
menuItem.setEnabled(false);
menu.add(menuItem);
}
}
public static void main(String[] args) {
DisabledImageHang window = new
DisabledImageHang((args.length == 0));
window.setTitle("Popup w/ Disabled Icons Bug");
window.setBounds(300, 300, 400, 400);
window.setVisible(true);
}
}
(Review ID: 102726)
======================================================================
Name: rlT66838 Date: 12/17/99
There is a huge performance regression seen in the initial
posting of a JMenu's popup menu if the menu items include icons
that are disabled. In 1.2.2 the menu is posted (and filled)
instantaneously, but in 1.3beta the posting/filling takes
roughly 5secs on my dual 300MHz NT4 system. The testcase below
was written so the menu items are disabled by default, but if you
include any command line arguments at all then the menu items
will not be disabled (makes it easy to compare performance of
enabled vs disabled items).
If the popup happens to be a heavyweight due to the size of the
initial frame then the popup is posted immediately it just won't
have any contents until that initial 5second delay is over.
Be sure to change the location of where the SwingSet images
directory is in the test code below.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class popupWithDisabledIconsBug extends JFrame {
// just use images from SwingSet
static final String IMAGES = "d:/jdk1.3beta/demo/jfc/SwingSet/images/";
static final String[] NAMES = {"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};
public popupWithDisabledIconsBug(boolean disable) {
JMenuBar menuBar;
JMenu menu;
JMenuItem menuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
menu = new JMenu("Test");
menu.setMnemonic('T');
menuBar.add(menu);
for (int i=0; i<NAMES.length; i++) {
menuItem = new JMenuItem("New Item #"+i);
menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
if (disable)
menuItem.setEnabled(false);
menu.add(menuItem);
}
}
public static void main(String[] args) {
popupWithDisabledIconsBug window = new popupWithDisabledIconsBug((args.length == 0));
window.setTitle("Popup w/ Disabled Icons Bug");
// set size so popup has to be a heavyweight
window.setSize(100, 200);
window.setVisible(true);
}
}
(Review ID: 94374)
======================================================================
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-I)
Java HotSpot(TM) Client VM (build 1.3-I, mixed mode)
Please note that I have already filed a bug report that has been entered
into the system as 4300430. The reason I'm entering a new bug report is that
4300430 only talks about a problem that showed up in 1.3beta where a large
slowdown in performance is seen. In 1.3ra this bug has turned into a hang
of the VM! I really need for someone to either confirm that this isn't a
problem in the latest engineering Kestrel build or to figure out a suitable
workaround if this won't get fixed for Kestrel. The person who evaluated the
original 4300430 but report was Roger Lewis.
Here's the problem in a nutshell. If a popup menu contains disabled icons
then the first time it's posted the VM can hang. Note that the hang _may_
not happen every time but my experience with this bug is that it happens
more often than not. Also note that the problem seems to be limited to
multiprocessor machines(I've got a dual processor NT system). I've also seen
the bug when toolbar buttons contain images that start off disabled. Here's
a simple testcase that has been used for bug report 4300430 that seems to
reproduce the problem. Once invoked, just click on the "Test" menubar button
to post the menu. If it comes up right away then reinvoke and try again.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class popupWithDisabledIconsBug extends JFrame {
// just use images from SwingSet
static final String IMAGES = "d:/jdk1.3ra/demo/jfc/SwingSet/images/";
static final String[] NAMES =
{"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};
public popupWithDisabledIconsBug(boolean disable) {
JMenuBar menuBar;
JMenu menu;
JMenuItem menuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
menu = new JMenu("Test");
menu.setMnemonic('T');
menuBar.add(menu);
for (int i=0; i<NAMES.length; i++) {
menuItem = new JMenuItem("New Item #"+i);
menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
if (disable)
menuItem.setEnabled(false);
menu.add(menuItem);
}
}
public static void main(String[] args) {
popupWithDisabledIconsBug window = new
popupWithDisabledIconsBug((args.length == 0));
window.setTitle("Popup w/ Disabled Icons Bug");
// set size so popup has to be a heavyweight
window.setSize(100, 200);
window.setVisible(true);
}
}
(Review ID: 100314)
======================================================================
Name: krT82822 Date: 04/02/2000
4/2/2000, eval1127@eng -- this was NOT reproducible with kestrel-rc2 (1.3.0rc2-Y) on a UNIPROCESSOR NT box.
However, as the user notes, this may be multi-processor-specific.
java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
I've been trying to get your guys attention for a long time about this issue.
Initially in 1.3beta the problem involved terribly long times to post menus that
had disabled images for the menu items. Then in 1.3RA the problem changed into a
full fledged hanging of the VM! The hang is still present in 1.3rc1 and
I'm afraid it will also be there in the upcoming official release of 1.3. Please
"same as" bug 4300430 to this new report since this one specifically talks about
the hang.
The test app that I've included below easily shows this rather devastating
problem. Unfortunately it may be that the problem is limited to multi-processor
NT machines(which is all that my company uses). Also the test app may need to be
run several times before you get a VM hang(I've always gotten it to happen in
under 5 trys).
Here is where the VM is hanging, as gotten by hitting Ctrl-C in the invoking
shell:
"AWT-EventQueue-0" prio=7 tid=0x784e10 nid=0xb0 waiting on monitor
[0x93df000..0x93dfdc8]
at java.lang.Object.wait(Native Method)
at java.awt.MediaTracker.waitForID(MediaTracker.java:632)
at javax.swing.ImageIcon.loadImage(ImageIcon.java:226)
at javax.swing.ImageIcon.<init>(ImageIcon.java:161)
at javax.swing.AbstractButton.getDisabledIcon(AbstractButton.java:542)
at
javax.swing.plaf.basic.BasicMenuItemUI.paintMenuItem(BasicMenuItemUI.java:561)
at
javax.swing.plaf.basic.BasicMenuItemUI.paint(BasicMenuItemUI.java:473)
at
javax.swing.plaf.basic.BasicMenuItemUI.update(BasicMenuItemUI.java:469)
at javax.swing.JComponent.paintComponent(JComponent.java:398)
at javax.swing.JComponent.paint(JComponent.java:739)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:546)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:719)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:23)
at
sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:54)
at
sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91)
at java.awt.Container.paint(Container.java:959)
at sun.awt.RepaintArea.paint(RepaintArea.java:298)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:193)
at java.awt.Component.dispatchEventImpl(Component.java:2665)
at java.awt.Container.dispatchEventImpl(Container.java:1212)
at java.awt.Window.dispatchEventImpl(Window.java:912)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
Here's the code (invoke w/ any arg to use non-disabled menu items):
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DisabledImageHang extends JFrame {
// ###
// ### UPDATE THE FOLLOWING PATH FOR YOUR SYSTEM
// ###
static final String IMAGES = "d:/jdk1.3rc1/demo/jfc/Notepad/resources/";
static final String[] NAMES =
{"cut.gif","copy.gif","paste.gif","open.gif","save.gif"};
public DisabledImageHang(boolean disable) {
JMenuBar menuBar;
JMenu menu;
JMenuItem menuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
menuBar = new JMenuBar();
setJMenuBar(menuBar);
menu = new JMenu("Test");
menu.setMnemonic('T');
menuBar.add(menu);
for (int i=0; i<NAMES.length; i++) {
menuItem = new JMenuItem("New Item #"+i);
menuItem.setIcon(new ImageIcon(IMAGES + "/" + NAMES[i]));
if (disable)
menuItem.setEnabled(false);
menu.add(menuItem);
}
}
public static void main(String[] args) {
DisabledImageHang window = new
DisabledImageHang((args.length == 0));
window.setTitle("Popup w/ Disabled Icons Bug");
window.setBounds(300, 300, 400, 400);
window.setVisible(true);
}
}
(Review ID: 102726)
======================================================================
- duplicates
-
JDK-4327282 AbstractButton.getDisabledIcon can cause the VM to hang! (dual-processor box)
- Closed