GNOME Bugzilla – Bug 761120
vino segfaults on wayland
Last modified: 2018-05-23 07:18:10 UTC
It would be nice to return some error on wayland instead of the following segfault: Program received signal SIGSEGV, Segmentation fault.
+ Trace 235932
See downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1211040
It crashes pretty often, see: https://retrace.fedoraproject.org/faf/problems/?component_names=vino&function_names=XQueryExtension
It should exit gracefully when X is unavailable.
Created attachment 368635 [details] [review] Return error if X11 is not detected Vino-server crashes on Wayland in XQueryExtension. Since vino-server is not expected to work on displays other than X11, let's exit immediately if GDK_IS_X11_DISPLAY fail.
Review of attachment 368635 [details] [review]: This is a test, please ignore.
Review of attachment 368635 [details] [review]: ::: server/vino-main.c @@ +237,3 @@ textdomain (GETTEXT_PACKAGE); + if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ())) I don't think you run that before gtk_init(). And it will fail in gtk_init(). Maybe use: gdk_set_allowed_backends() instead, and use gtk_init_check() to avoid asserting if X11 isn't available.
Hmm, gdk_set_allowed_backends ("x11"); seems to force XWayland to be used, which is not desired. Consequently, vino-server starts without crash, however, it crashes on XGetImage when trying to establish a connection: (vino-server:12170): Gdk-ERROR **: 13:31:55.982: The program 'vino-server' received an X Window System error. This probably reflects a bug in the program. The error was 'BadMatch (invalid parameter attributes)'. (Details: serial 253 error_code 8 request_code 73 (core protocol) minor_code 0) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the GDK_SYNCHRONIZE environment variable to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) So, not sure what is a right way to do the check...
Created attachment 368712 [details] [review] Return error if X11 is not detected Move the check after gtk_init, respectively g_option_context_parse.
It seems that Arch Linux is using this patch already: https://git.archlinux.org/svntogit/packages.git/commit/trunk/dont-crash-on-wayland.patch?h=packages/vino&id=e251c1cb96dc2a57f32ef2dd40154dd84a770b1f Is there any chance that somebody can review this patch?
Review of attachment 368712 [details] [review]: Sure, seems fine.
Thanks! Attachment 368712 [details] pushed as d5b743b - Return error if X11 is not detected
Created attachment 372353 [details] [review] Do not restart service after unclean exit code Currently, the vino-server.service has Restart=on-failure, which means that it is restarted in abnormal cases, but also in case of non-zero exit code. It is restarted 5 times e.g. in case when X11 is not detected, which doesn't make sense. Non-zero exit code is used only for states which won't change with restart (invalid commandline, wayland and some sanity checks). Change the value to Restart=on-abnormal in order to prevent the useless restarts and to not spam journal.
Review of attachment 372353 [details] [review]: Sure.
Thanks! Attachment 372353 [details] pushed as c5e3011 - Do not restart service after unclean exit code