JDK-8322087 : Deadlock of CInputMethod.getTextLocation and webkit InputMethodClientImpl.getTextLocation with macOS 14 (Sonoma)
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: jfx17
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • Submitted: 2023-12-14
  • Updated: 2023-12-22
  • Resolved: 2023-12-22
Related Reports
Duplicate :  
Relates :  
Description
When running a JavaFX WebView embedded in a JFXPanel on macOS 14, right after hitting the Caps lock key, a deadlock happens and the application freezes.

To reproduce, run the attached test with JDK 17+ and JavaFX 17+, and when the webView shows up, just hit the Caps lock key. The application will freeze.

A thread dump will show:

"AWT-EventQueue-0" #22 [55307] prio=6 os_prio=31 cpu=146.91ms elapsed=20.07s tid=0x000000011786b400 nid=55307 waiting on condition  [0x00000001722f5000]
   java.lang.Thread.State: WAITING (parking)
        at jdk.internal.misc.Unsafe.park(java.base@21/Native Method)
        - parking to wait for  <0x000000070fd64bd8> (a java.util.concurrent.FutureTask)
        at java.util.concurrent.locks.LockSupport.park(java.base@21/LockSupport.java:221)
        at java.util.concurrent.FutureTask.awaitDone(java.base@21/FutureTask.java:500)
        at java.util.concurrent.FutureTask.get(java.base@21/FutureTask.java:190)
        at com.sun.javafx.webkit.InputMethodClientImpl.getTextLocation(javafx.web@21.0.1/InputMethodClientImpl.java:139)
        at javafx.scene.Scene$InputMethodRequestsDelegate.getTextLocation(javafx.graphics@21.0.1/Scene.java:4169)
        at javafx.embed.swing.InputMethodSupport$InputMethodRequestsAdapter.getTextLocation(javafx.swing@21.0.1/InputMethodSupport.java:61)
        at sun.awt.im.InputMethodContext.getTextLocation(java.desktop@21/InputMethodContext.java:279)
        at sun.lwawt.macosx.CInputMethod$6.run(java.desktop@21/CInputMethod.java:722)
        - locked <0x000000070fc761c8> (a [I)
        at java.awt.event.InvocationEvent.dispatch(java.desktop@21/InvocationEvent.java:308)
        at java.awt.EventQueue.dispatchEventImpl(java.desktop@21/EventQueue.java:773)
        at java.awt.EventQueue$4.run(java.desktop@21/EventQueue.java:720)
        at java.awt.EventQueue$4.run(java.desktop@21/EventQueue.java:714)
        at java.security.AccessController.executePrivileged(java.base@21/AccessController.java:778)
        at java.security.AccessController.doPrivileged(java.base@21/AccessController.java:400)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@21/ProtectionDomain.java:87)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@21/ProtectionDomain.java:98)
        at java.awt.EventQueue$5.run(java.desktop@21/EventQueue.java:747)
        at java.awt.EventQueue$5.run(java.desktop@21/EventQueue.java:745)
        at java.security.AccessController.executePrivileged(java.base@21/AccessController.java:778)
        at java.security.AccessController.doPrivileged(java.base@21/AccessController.java:400)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@21/ProtectionDomain.java:87)
        at java.awt.EventQueue.dispatchEvent(java.desktop@21/EventQueue.java:744)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@21/EventDispatchThread.java:203)
        at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@21/EventDispatchThread.java:124)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@21/EventDispatchThread.java:113)
        at java.awt.EventDispatchThread.pumpEvents(java.desktop@21/EventDispatchThread.java:109)
        at java.awt.EventDispatchThread.pumpEvents(java.desktop@21/EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.run(java.desktop@21/EventDispatchThread.java:90)

which points to  com.sun.javafx.webkit.InputMethodClientImpl.getTextLocation and sun.awt.im.InputMethodContext.getTextLocation, in a very similar way than this open issue: https://bugs.openjdk.org/browse/JDK-8221261

Comments
I can confirm that this is the same bug as JDK-8221261, although *much* more easily reproducible on macOS 14. I am closing this bug as a duplicate and bumping the priority of JDK-8221261 to P2.
22-12-2023

This is consistently reproducible and a blocking issue for the usage of affected applications on macOS 14.
14-12-2023

Yes, the stack trace does look similar to JDK-8221261, so the root cause might be the same (in which case we would close this as a duplicate of that). It's possible that it happens more frequently on macOS 14 due to change in the OS.
14-12-2023