-
Bug
-
Resolution: Unresolved
-
P3
-
17.0.12, 21.0.4, 22.0.2, 23
A DESCRIPTION OF THE PROBLEM :
Our customer uses a Windows Server 2022 VM on a Hyper-V environment via Azure to run our Swing application.
The application crashes when trying to repaint components while being disconnected from the VM.
It seems like the VM is removing the virtual monitors leaving the application without a screen device,
Stacktrace:
java.lang.IllegalArgumentException: Width (-2147483648) and height (0) cannot be <= 0
at java.desktop/java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleImage(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleImage(Unknown Source)
at java.desktop/sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
at java.desktop/sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
at java.desktop/sun.awt.image.VolatileSurfaceManager.displayChanged(Unknown Source)
at java.desktop/sun.awt.SunDisplayChanger.notifyListeners(Unknown Source)
at java.desktop/sun.awt.Win32GraphicsEnvironment.displayChanged(Unknown Source)
at java.desktop/sun.awt.windows.WToolkit.lambda$displayChanged$4(Unknown Source)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
2024-09-24 15:45:09,203 ERROR [AWT-EventQueue-0] d.s.a.c.s.SystemExceptionHandler - Fehler im Thread: AWT-EventQueue-0
java.awt.AWTError: no screen devices
at java.desktop/sun.awt.Win32GraphicsEnvironment.getDefaultScreenDevice(Unknown Source)
at java.desktop/sun.awt.windows.WWindowPeer.updateGC(Unknown Source)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
2024-09-24 15:45:09,225 ERROR [AWT-EventQueue-0] d.s.a.c.s.SystemExceptionHandler - Fehler im Thread: AWT-EventQueue-0
java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
at java.desktop/sun.awt.image.SunVolatileImage.<init>(Unknown Source)
at java.desktop/sun.awt.image.SunVolatileImage.<init>(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
at java.desktop/javax.swing.RepaintManager.getVolatileOffscreenBuffer(Unknown Source)
at java.desktop/javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at java.desktop/javax.swing.RepaintManager.paint(Unknown Source)
at java.desktop/javax.swing.JComponent._paintImmediately(Unknown Source)
at java.desktop/javax.swing.JComponent.paintImmediately(Unknown Source)
at java.desktop/javax.swing.JLayer.paintImmediately(Unknown Source)
at java.desktop/javax.swing.plaf.LayerUI.paintImmediately(Unknown Source)
at java.desktop/javax.swing.JLayer.paintImmediately(Unknown Source)
at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source)
at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
The crash log seems to suggest a display change:
Classes loaded (20 events):
Event: 296.229 Loading class javax/swing/RepaintManager$DisplayChangedRunnable
Event: 296.230 Loading class javax/swing/RepaintManager$DisplayChangedRunnable done
Our analysis suggests https://bugs.openjdk.org/browse/JDK-8185862 seems to be the culprit while being related to https://bugs.openjdk.org/browse/JDK-8336862.
The problem cannot be reproduced on Java 17.0.11 or before.
REGRESSION : Last worked in version 17
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Start the application on the VM
2. Disconnect from the VM
3. Wait a few seconds
4. Reconnect to the VM
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application keeps running
ACTUAL -
The application crashes with mentioned stacktrace
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.Timer;
import java.awt.Dimension;
import java.time.ZonedDateTime;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame("Java Window");
frame.setMinimumSize(new Dimension(480, 160));
JLabel label = new JLabel("Hello World!", SwingConstants.CENTER);
frame.getContentPane().add(label);
frame.setVisible(true);
Timer timer = new Timer(1000,
e -> label.setText(ZonedDateTime.now().toString()));
timer.start();
}
}
---------- END SOURCE ----------
FREQUENCY : often
Our customer uses a Windows Server 2022 VM on a Hyper-V environment via Azure to run our Swing application.
The application crashes when trying to repaint components while being disconnected from the VM.
It seems like the VM is removing the virtual monitors leaving the application without a screen device,
Stacktrace:
java.lang.IllegalArgumentException: Width (-2147483648) and height (0) cannot be <= 0
at java.desktop/java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleImage(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleImage(Unknown Source)
at java.desktop/sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
at java.desktop/sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
at java.desktop/sun.awt.image.VolatileSurfaceManager.displayChanged(Unknown Source)
at java.desktop/sun.awt.SunDisplayChanger.notifyListeners(Unknown Source)
at java.desktop/sun.awt.Win32GraphicsEnvironment.displayChanged(Unknown Source)
at java.desktop/sun.awt.windows.WToolkit.lambda$displayChanged$4(Unknown Source)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
2024-09-24 15:45:09,203 ERROR [AWT-EventQueue-0] d.s.a.c.s.SystemExceptionHandler - Fehler im Thread: AWT-EventQueue-0
java.awt.AWTError: no screen devices
at java.desktop/sun.awt.Win32GraphicsEnvironment.getDefaultScreenDevice(Unknown Source)
at java.desktop/sun.awt.windows.WWindowPeer.updateGC(Unknown Source)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
2024-09-24 15:45:09,225 ERROR [AWT-EventQueue-0] d.s.a.c.s.SystemExceptionHandler - Fehler im Thread: AWT-EventQueue-0
java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
at java.desktop/sun.awt.image.SunVolatileImage.<init>(Unknown Source)
at java.desktop/sun.awt.image.SunVolatileImage.<init>(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
at java.desktop/java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
at java.desktop/javax.swing.RepaintManager.getVolatileOffscreenBuffer(Unknown Source)
at java.desktop/javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at java.desktop/javax.swing.RepaintManager.paint(Unknown Source)
at java.desktop/javax.swing.JComponent._paintImmediately(Unknown Source)
at java.desktop/javax.swing.JComponent.paintImmediately(Unknown Source)
at java.desktop/javax.swing.JLayer.paintImmediately(Unknown Source)
at java.desktop/javax.swing.plaf.LayerUI.paintImmediately(Unknown Source)
at java.desktop/javax.swing.JLayer.paintImmediately(Unknown Source)
at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source)
at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
The crash log seems to suggest a display change:
Classes loaded (20 events):
Event: 296.229 Loading class javax/swing/RepaintManager$DisplayChangedRunnable
Event: 296.230 Loading class javax/swing/RepaintManager$DisplayChangedRunnable done
Our analysis suggests https://bugs.openjdk.org/browse/JDK-8185862 seems to be the culprit while being related to https://bugs.openjdk.org/browse/JDK-8336862.
The problem cannot be reproduced on Java 17.0.11 or before.
REGRESSION : Last worked in version 17
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Start the application on the VM
2. Disconnect from the VM
3. Wait a few seconds
4. Reconnect to the VM
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application keeps running
ACTUAL -
The application crashes with mentioned stacktrace
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.Timer;
import java.awt.Dimension;
import java.time.ZonedDateTime;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame("Java Window");
frame.setMinimumSize(new Dimension(480, 160));
JLabel label = new JLabel("Hello World!", SwingConstants.CENTER);
frame.getContentPane().add(label);
frame.setVisible(true);
Timer timer = new Timer(1000,
e -> label.setText(ZonedDateTime.now().toString()));
timer.start();
}
}
---------- END SOURCE ----------
FREQUENCY : often
- relates to
-
JDK-8185862 AWT Assertion Failure in ::GetDIBits(hBMDC, hBM, 0, 1, 0, gpBitmapInfo, 0) 'awt_Win32GraphicsDevice.cpp', at line 185
-
- Resolved
-