JDK-8322703 : Intermittent crash in WebView in a JFXPanel from IME calls on macOS
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8,jfx21
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2023-12-22
  • Updated: 2024-03-01
  • Resolved: 2024-01-30
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 8 Other
8u411Fixed jfx17.0.11Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
To reproduce, do the following on macOS 14 Sonoma:

1. Run the attached Swing / JavaFX interop test program:
$ java HelloWebViewJFXPanel

2. Press the CAPS LOCK key

BUG: It will either hit the deadlock described in JDK-8221261 or it will crash

This JBS BUG bug will track the crash. This is likely caused by calling into WebKit on the wrong thread from the WebKit IME code. A similar bug was fixed in JDK-8196011.

I discovered this while doing some testing of a proposed fix for JDK-8221261 / PR openjdk/jdk#17184 [1], I ran into a crash where native WebKit code is being called on the AWT Event thread. This suggests that other JavaFX WebView InputMethodClientImpl methods will likely need the same treatment that firstRectForCharacterRange and characterIndexForPoint got in the fix for JDK-8196011. This crash isn't caused by the proposed fix for the deadlock, since I see it intermittently with a JDK without the deadlock fix (e.g., JDK 21.0.1).
Comments
[jfx17u-fix-request] Approval Request from José Pereda
01-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jfx17u/pull/179 Date: 2024-02-29 15:48:30 +0000
29-02-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jfx21u/pull/45 Date: 2024-02-29 09:22:38 +0000
29-02-2024

[jfx21u-fix-request] Same applies for jfx21u
28-02-2024

[jfx22u-fix-request] Approval Request from Kevin Rushforth Would like to get important fix for WebKit crash into jfx22u for 22.0.1
30-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jfx22u/pull/8 Date: 2024-01-30 16:57:37 +0000
30-01-2024

Changeset: 40809a3f Author: Kevin Rushforth <kcr@openjdk.org> Date: 2024-01-30 16:38:34 +0000 URL: https://git.openjdk.org/jfx/commit/40809a3f84d5f9f91b265f455a95d045e5b4f692
30-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jfx/pull/1321 Date: 2024-01-05 23:59:31 +0000
06-01-2024

I have a fix for this that I have been testing in connection with the fix for JDK-8221261. I'll send a PR once I complete my testing.
05-01-2024

A quick test applying the same fix from JDK-8196011 to two more methods in InputMethodClientImpl.java, getSelectedText and getInsertPositionOffset prevents the crash. Testing that fix in connection with the prototype fix for JDK-8221261 (so we don't get the deadlock) looks promising. Much more testing is needed, though.
22-12-2023