JDK-8210411 : JavaFX crashes on Ubuntu 18.04 with Wayland
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: openjfx11
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • Submitted: 2018-09-05
  • Updated: 2021-09-28
  • Resolved: 2018-12-21
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
8u212Fixed openjfx11.0.2Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Sub Tasks
JDK-8210678 :  
Description
Ubuntu 18.04 optionally uses Wayland.
JavaFX on linux uses the GtkGlassApplication, which takes jdk,gtk.version to determine which version of GTK to use, and that defaults to 3.

However, using XWayland crashes at a number of places.

By reverting to GTK 2 on said system, there is no crash.
Comments
Changeset: 4b5124cce8cf Author: pbansal Date: 2018-12-21 12:10 +0530 URL: http://hg.openjdk.java.net/openjfx/jfx-dev/rt/rev/4b5124cce8cf 8210411: JavaFX crashes on Ubuntu 18.04 with Wayland Reviewed-by: kcr, mbilla
21-12-2018

+1
20-12-2018

+1
20-12-2018

Please review the fix webrev: http://cr.openjdk.java.net/~pbansal/8210411/webrev.00/ Issue: JavaFX uses both X11 and gtk code. The JavaFX (Version 11 onwards) uses gtk3 as default and gtk3 uses Wayland backend while running Ubuntu 18.04 in Wayland mode. This results in crash in JavaFX. This does not affect gtk2 as gtk2 does not support Wayland backend at all. Fix: The fix sets the gtk backend ro x11 backend even in Wayland mode by setting GDK_BACKEND=x11. This fixes the crash. Notes: 1. While using the a JFXPanel inside Swing components in Swing-FX interop, the AWT loads the gtk3 first and as the GDK_BACKEND=x11 is not yet set even after the fix, the gtk3 falls back to Wayland. Then while initializing the JFXPanel, it uses the same library loaded by AWT and this results in crash. To fix this, a bug has been filled against AWT https://bugs.openjdk.java.net/browse/JDK-8215364. For testing the current fix, set the GDK_BACKEND=x11 in your environment (Terminal) and Swing-FX interop should work fine. 2. While using SWT-FX interop, same issue is being found. To run SWT-FX interop, set the GDK_BACKEND=x11 in your environment (Terminal) and it should work fine.
14-12-2018

I attached the crash log from the Github issue.
02-11-2018

Workaround (https://github.com/javafxports/openjdk-jfx/issues/175#issuecomment-417030981) java -Djdk.gtk.version=2
21-09-2018

Note that Wayland is not the default for Ubuntu 18.04. https://blog.ubuntu.com/2018/01/26/bionic-beaver-18-04-lts-to-use-xorg-by-default
05-09-2018

See also github discussion https://github.com/javafxports/openjdk-jfx/issues/175
05-09-2018