-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High CPU load when screen is off - Width (0) and height (0) cannot be <= 0 #8079
Comments
@shadowfly256 thanks a lot for taking your time and posting such detailed bug report. |
I am wondering what your system does when all screens are unplugged. In my case it keeps at least one graphics device. public static void main(String[] args) {
JFrame frame = new JFrame("test");
frame.setSize(400, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
new Thread(() -> {
while(true) {
try {
Thread.sleep(2000);
SwingUtilities.invokeLater(() -> {
List<GraphicsDevice> devices = List.of(GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices());
GraphicsConfiguration gc = frame.getGraphicsConfiguration();
System.out.println("s: %s, d: %s, gc: %s, devs: %s".formatted(frame.isShowing(), frame.isDisplayable(), gc, devices));
});
} catch (InterruptedException ex) {
return;
}
}
}).start();
}
I unplugged both screens and the frame still had a graphics configuration and a device assigned. So I likely won't be able to reproduce this on gnome / cinnamon. (also NB 24 was doing fine running in the background without exceptions in the log) |
For me, the output is just like it is for you:
When i select this program in VisualVM, and turn the screen off, nothing happens.
Somehow the Exceptions say NetBeans even though i made sure to close NetBeans. As for NetBeans: Widowing NetBeans does not protect it from the bug (at least not for me).
So i don't know if these Exceptions are form the test program or VisualVM. Unfortunatley i don't know how to get the test program's exceptions without VisualVM. Journal while i turn the screen off:
|
I just tried to reproduce the bug on my laptop, but i was unable to reproduce it:
So maybe we need Wayland and or Plasma 6 for the bug to show up. |
Apache NetBeans version
Apache NetBeans 24
What happened
I switched my monitor off to preserve some power while idling. My CPU started getting hot immediately. I looked at my TaskManager and found NetBeans using one CPU core at 100%.
I then used VisualVM to profile NetBeans to see if it's "easy" to fix, and the terminal output of VisualVM filled with exceptions like this:
Then i realized that both NetBeans and VisualVM's GUIs were glitching:
So i closed NetBeans, and switched off my screen. My CPU shot to 100% again. So yes, this bug is not NetBeans exclusive.
Without NetBeans or VisualVM my CPU remains cool.
Then i tried a simple Java GUI program, as i thought this might be a Java bug. But no, a simple Java JFrame does not create problems.
This is the reason why i did not report this to OpenJDK.
I hope this is not the wrong place for this bug. Maybe this should be an OpenJDK bug, but i am sure you can tell me.
Thanks for the awesome FOSS IDE by the way.
Language / Project Type / NetBeans Component
Java Ant application
How to reproduce
Did this work correctly in an earlier version?
No / Don't know
Operating System
Gentoo Linux 2.17 KDE Plasma Version: 6.2.4 Kernel Version: 6.6.62-gentoo
JDK
Gentoo host: openjdk 17.0.13 2024-10-15 >> NetBeans Flatpak: jdk21
Apache NetBeans packaging
Other
Anything else
NetBeans package: Flatpak - org.apache.netbeans//24
Reproducable: Always
VisualVM "source of load":
Are you willing to submit a pull request?
No
The text was updated successfully, but these errors were encountered: