Closed fedeinthemix closed 1 year ago
It does not happen for me. But can you try add ImageView@0.11.1
and see if that fixes it?
Just in case it's image-specific, can you direct me to an image that triggers the crash for you? I tried testimage("lighthouse")
from TestImages.jl, and that does not crash (for me).
Oh, also try ImageView@0.11.3
, I forgot that was the latest release. In general you should update your packages, an important Gtk.jl bug-fix happened just a couple of days ago.
I tried ImageView@0.11.3
and ImageView@0.11.1
with testimage("lighthouse")
and I get the same segmentation fault error with both version.
This is going to be very hard for me to debug since I can't replicate it. It may be Wayland-specific? (See the top few lines of the stacktrace.)
@giordano, any ideas? We're not relying in any way on the system Gtk, right? But presumably the distinction between Wayland and my default Ubuntu system still matters?
We're not relying in any way on the system Gtk, right?
No, and judging by the stack trace this is all happening inside our artifacts.
Is there a reasonable plan forward? macOS also seems to have issues, see https://github.com/JuliaImages/ImageView.jl/actions/runs/3841921340/jobs/6542696058, and more expansively https://github.com/JuliaGizmos/GtkObservables.jl/actions/runs/3842033680/jobs/6542932322. Of course these two (unlike the OP here) only happen on nightly, which is concerning on its own. But I can't replicate either issue locally.
I've found the problem. For some reason the library doesn't find the fonts. If I start julia as follows it works
FONTCONFIG_FILE=/etc/fonts/fonts.conf julia
With it, when I right click on the figure I get the following messages, but it doesn't crash anymore
julia> Gdk-Message: 17:45:46.161: Window 0x3ac3600 is a temporary window without parent, application will not be able to position it on screen.
(julia:33997): Gdk-CRITICAL **: 17:45:46.267: gdk_wayland_window_handle_configure_popup: assertion 'impl->transient_for' failed
Not sure if this is expected or not, especially the second, critical one.
The question now is: why doesn't it find the fonts. One peculiarity of NixOS worth mentioning is that the artifacts are made available to the packages as read only. Could this be a problem?
During compilation I notice the message Fontconfig error: No writable cache directories
. Is ImageView
trying to install fonts? Where?
I think I understand now. Julia's Fontconfig_jll
distributes a configuration file that points to directories not used on NixOS. This is fixed by the env. variable. Then ImageView
tries to install a font cache in the user home directory which on NixOS (building packages in a sandbox) is not accessible during package compilation, but it's not a problem.
So,in the end it was a matter of understanding how to use the package on a peculiar system like NixOS. But it would be nice to avoid segmentation fault errors even when no fonts are found :-)
Regarding the messages in the previous comment: They disappear if I set GDK_BACKEND=x11
and appear with GDK_BACKEND=wayland
(which is the default on my system). In spite of this the package seems to work correctly (very little testing). Is any problem expected on Wayland? Do you recommend to set it to X11?
So,in the end it was a matter of understanding how to use the package on a peculiar system like NixOS. But it would be nice to avoid segmentation fault errors even when no fonts are found :-)
I don't think Julia folks can do anything about this. You could consider contacting the Gtk developers.
Is any problem expected on Wayland? Do you recommend to set it to X11?
I have no experience, so I really have no idea.
Congrats and great work on identifying the source of the bug!
Thanks for the help!
When I try the example on the main page
I initially see the image. However, when I move the mouse pointer over the window Julia crashes with the following output:
Using Linux NixOS 22.11 (x86_64) Gnome 43.2 on Wayland Julia 1.8.3 ImageView.jl 0.11.2 Images.jl 0.25.2 Gtk.jl 1.3.0