JDK-8195830 : Application uses higher CPU in 8u161/8u162
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u161
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: other
  • CPU: x86
  • Submitted: 2018-01-18
  • Updated: 2018-01-23
  • Resolved: 2018-01-23
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]

A DESCRIPTION OF THE PROBLEM :
Swing applications uses a lot of CPU after upgrading to 8u161/8u162

REGRESSION.  Last worked in version 8u152

ADDITIONAL REGRESSION INFORMATION: 
Broken in 8u161/8u162
OK in 8u151/8u152
OK in 9.0.4

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run application
Click in JTextField
Click in another application (like Outlook, Chrome or other)
Click in JTextField.
After a few tries, CPU spikes

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No CPU usage after switching between applications
ACTUAL -
17% cpu load on an 8 core machine
29% cpu load on an 4 core machine

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class Test1{
	public static void main(String... args) {
		JFrame f = new JFrame("Test");
		JTabbedPane tp = new JTabbedPane();
		tp.addTab("tab 1", new JTextField(20));
		f.add(tp);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.pack();
		f.setLocationRelativeTo(null);
		f.setVisible(true);
	}
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Clicking the tab in the JTabbedPane seems to stop CPU usage.
I have found no other workarounds.

SUPPORT :
YES


Comments
The bug has been fixed in 8u172 b01. The 8u172 early access build is available at http://jdk.java.net/8/. If the bug is still reproducible with 8u172, please notify us or file an incident through https://bugreport.java.com
2018-01-23

Duplicate of JDK-8183504 http://mail.openjdk.java.net/pipermail/awt-dev/2018-January/013479.html
2018-01-23

Issue reported on stackoverflow - https://stackoverflow.com/questions/48339199/java-8u161-8u162-makes-swing-app-use-cpu
2018-01-23

Reported with: =========== JDK 8u161/8u162 Windows 10 Checked with: JDK 8u161/8u162 Windows 10 CPU usage spike to a bug number when the Swing application is run with JDK 8u161/8u162. Results: ========= 8u151: OK 8u152: OK 8u161: FAIL 8u162: FAIL 8u172 b03: OK 9.0.4: OK 10 ea b39: OK This seems a regression with 8u161, as the CPU spike to a >30% on a 4 core CPU machine for the attached test case.
2018-01-22