JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.63k stars 2.59k forks source link

Linux version of JabRef: Gdk-WARNING: XSetErrorHandler() called with a GDK error trap pushed. Don't do that. #8780

Open ThiloteE opened 2 years ago

ThiloteE commented 2 years ago

JabRef version

5.6 (latest release)

Operating system

GNU / Linux

Details on version and operating system

JabRef 5.6--2022-04-25--5c9d898 Linux 5.4.0-109-generic amd64 Java 17.0.2 JavaFX 18+12

Checked with the latest development build

Steps to reproduce the behaviour

Problem:

There have been multiple reports (my personal report and e.g. https://github.com/JabRef/jabref/issues/8416#issue-1099965953) of this warning message in Linux versions.

My personal Log File ``` (For context: I personally used JabRef portable 5.6 on Linux Mint and GTK 3 libraries were installed) thilo@thilo-Aspire-ES1-311:~/Programme/JabRef 5.6 Linux portable/lib/runtime/bin$ ./JabRef Mai 09, 2022 7:17:36 PM com.sun.javafx.application.PlatformImpl startup WARNUNG: Unsupported JavaFX configuration: classes were loaded from 'module org.jabref.merged.module', isAutomatic: false, isOpen: true 2022-05-09 19:17:37 [JavaFX Application Thread] org.jabref.logic.net.ssl.TrustStoreManager.createTruststoreFileIfNotExist() INFO: Trust store path: /home/thilo/.local/share/ssl/truststore.jks 2022-05-09 19:17:43 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.updateThemeSettings() INFO: Not updating theme because it hasn't changed 2022-05-09 19:17:43 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.updateThemeSettings() INFO: Theme set to Theme{type=DEFAULT, name=''} with base css StyleSheet{jrt:/org.jabref/org/jabref/gui/Base.css} May 09, 2022 7:17:46 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged WARNING: Resource "" not found. (java:13806): Gdk-WARNING **: 19:17:46.316: XSetErrorHandler() called with a GDK error trap pushed. Don't do that. May 09, 2022 7:17:52 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged WARNING: Resource "" not found. ```

I don't know if XSetErrorHandler() called with a GDK error trap pushed. triggers any bugs in JabRef yet, but somebody must have deemed this important enough to implement some kind of warning. Just reporting what I found out so far.

Likely cause of problem:

  1. Most likely the main culprit: https://bugs.openjdk.java.net/browse/JDK-8156779
  2. Related discussion about this error message on stackoverflow points to problem with JavaFX and problems with GTK 3.
  3. Another Interesting story also points to JavaFX and problem with wayland / X11 window system

    I finally understand what's happening. And it's indeed related to GTK3/GDK3.

    Negatron uses OpenJFX as its main graphical library. And OpenJFX 11+ has migrated from GTK2 to GTK3 but, with GTK3, a lot of Linux distros have changed the graphical backend from X11 to Wayland. So, OpenJFX 11 couldn't work with those Linux distros using Wayland because OpenJFX 11 doesn't have a compatibility layer with Wayland, only with X11. To avoid having to develop a full compatibility layer with Wayland, OpenJFX 12+ simply added a hack to force GTK3 to work with X11.

    The thing is Negatron uses VLC to play video files. And for this to happen, the library to embed VLC within Negatron (VLCj) uses AWT, another Java graphical library. AWT can work with X11 and Wayland without issues. So, I think that AWT overrides the hack used by OpenJFX and forces the use of the newest Wayland graphical backend, screwing up OpenJFX along the way...

    So, I have 3 solutions at hand, sorted by increasing complexity and also from the worst to the best solution: 1/ completely rewrite the file chooser dialog box in pure Java, thus killing OS integration for those common dialogues in Linux, and hope that this GTK3 issue doesn't screw anything else up. 2/ rewrite a part of VLCj so that it doesn't use AWT anymore. 3/ write the Wayland compatibility layer that nobody at OpenJFX wants to write...

Rudimentary explanation:

JabRef uses JavaFX.

In some rare instances JavaFX will have to disable their error handler and at the same time for some reason, the GTK error handler could not be disabled. Then, somehow during this process an error trap is pushed but not popped. There does not seem to be an easy workaround.

Additional info:

GTKX11 error trap documentation:

Appendix

No response

ThiloteE commented 2 years ago

Solution:

joneumann commented 1 year ago

Can confirm this is still a thing for

JabRef 5.10--2023-09-01--779e555 Linux 5.15.90.1-microsoft-standard-wsl2 amd64 Java 21-internal JavaFX 20+19

2023-10-12 08:45:33 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.updateThemeSettings()
INFO: Theme set to Theme{type=DEFAULT, name=''} with base css StyleSheet{jrt:/org.jabref/org/jabref/gui/Base.css}

(java:796): Gdk-WARNING **: 08:45:33.840: XSetErrorHandler() called with a GDK error trap pushed. Don't do that.
Oct 12, 2023 8:45:33 AM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
WARNING: Resource "" not found.
Oct 12, 2023 8:45:35 AM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
WARNING: Resource "" not found.
ryan-carpenter commented 11 months ago

JabRef 5.11--2023-10-21--affb6ac Linux 5.15.133.1-microsoft-standard-wsl2 amd64 Java 21.0.1 JavaFX 20.0.2+3

(JabRef:28989): Gdk-WARNING **: 11:50:00.384: XSetErrorHandler() called with a GDK error trap pushed. Don't do that.
2023-11-29 11:50:02 [pool-1-thread-1] org.jabref.gui.JabRefDialogService.notify()