JDK-8202768 : [macos] Appkit thread slows when any Window Manager active
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.accessibility
  • Affected Version: 8u131,9,10,11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2018-05-04
  • Updated: 2019-05-17
  • Resolved: 2018-06-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 Other
11 b19Fixed openjdk8u222Fixed
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
macOS Sierra 10.12.6

Issue appears in other tested versions osx 10.9.5+ 
Also occurs in JDK 8u171

A DESCRIPTION OF THE PROBLEM :
If you have nested panels in a Java application and a Window Manager app active (Magnet, Moom, SnapIt) any click on/focus event from the lower components causes the Java application to hang

REGRESSION : Last worked in version 10.0.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Install and enable a Window manager app, SnapIt is free
Run the code below

Note: if using JDK 8 increase the panel depth to 20 to see full hang without recovery, depth of 10 will recover after a while

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Can click on the component without application hang
ACTUAL -
Application hangs

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;

public class Main {

    public static void main(String[] args) {
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(new Dimension(400,400));

        final Container content = frame.getContentPane();
        content.setLayout(new BorderLayout());
        
        Container lastPanel = content;
        for (int i = 0; i < 10; i++) {
            final JPanel p = new JPanel();
            lastPanel.add(p);
            lastPanel = p;
        }
        lastPanel.setBackground(Color.blue);
 
        frame.setVisible(true);
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Disable the Windows Manager app in the System Accessibility options

FREQUENCY : always



Comments
Fix request for 8u: This fixes regression (hang) introduced in 8u. The patch applies cleanly after unshuffling. The regression test (test/javax/accessibility/SlowPanelIteration/SlowPanelIteration.java) fails without the fix and passes with the fix applied.
26-04-2019

Regression of: JDK-8145207 Infinite loop in this line: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/233b59b7ea2f#l8.97
31-05-2018

Looks like caused by JDK-8076554 or JDK-8145207
30-05-2018

Adding additional note from submitter: ====================================== The issue is still present in 11-ea+13 Going back through the 8 updates it looks like the issue was introduced in 152, last working version is 151 ====================================
11-05-2018

8u171 and others are come from the submitter and description of the bug. It is a regression somewhere before 8u171 since 8u130 works fine.
10-05-2018

[~serb] is it a regression introduced in 8u171?
10-05-2018

[~serb] does it affect 9? 8?
10-05-2018

Submitter has confirmed that the issue is reproducible across different JDK versions including 8u172, 9.0.4 and 10.0.1 and will check with 11 ea build as well. Issue occurred with a 3rd party application iSnap launched and running simultaneously. He has also shared a video snippet showcasing the issue (see attached in subsequent comment). ===================================================================== Thanks for the reply, apologies but I named the wrong free app, rather than snapit could you please try iSnap Once iSnap is installed you can enable it int he System Preferences as shown in the link below http://mizage.com/help/accessibility.html If both apps are running, iSnap seems to engage everytime a mouse event occurs. It looks like the componenet focus travels up to the JRootPane and the AppKit thread hangs and continues to eat memory somewhere in the JRootPane's RootLayout (at least that's the last call i could see with logging level set as fine before the hang). The AppKit thread was spotted in Java Mission Control, I'm not too familiar with using it but I can try to get a screen shots or more info if it would help or you have any steps I could follow. The test app was written on an old mac book air (~2011) so it may be that the depth of nested panels needs increasing on a newer machine but I have found it consistently happens over 20 levels of depth. ===================================================================== Update: We have seen the issue on OSX 10.9.5, 10.13.0, 10.12.0 and 10.12.6 so far, there doesn't seem to be a way to update to 10.13.1 so we are going to try the latest 10.13.4 The issue occurs with Java 8u172, 9.04 and 10.0.1 but we will also try the early access version of 11
10-05-2018

Reported with JDK 10.0.1, Java applications with nested panels hung if a Window Manager app is active. Checked this with the reported version in MAC OS X 10.13.1 with couple of different Window managers, but could not reproduce as stated. the application worked fine. Result: ======= 8u171: OK 10: OK 10.0.1: OK 11 ea b10: OK Writing back to the submitter to reconfirm at his end and provide any additional step/information that could help evalaute this better.
08-05-2018