After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787568 - Segmentation fault in _cogl_boxed_value_set_x when (e.g.) launching VMs in virt-manager or boxes
Segmentation fault in _cogl_boxed_value_set_x when (e.g.) launching VMs in vi...
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.25.x
Other Linux
: Normal critical
: ---
Assigned To: mutter-maint
mutter-maint
: 768959 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-09-12 01:16 UTC by Adam Williamson
Modified: 2017-11-03 03:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
inhibitShortcuts: Don't destroy actor when hiding (1.05 KB, patch)
2017-09-12 04:25 UTC, Jonas Ådahl
none Details | Review
[PATCH] wayland: Keep the inhibit shortcut dialog (5.49 KB, patch)
2017-09-12 08:33 UTC, Olivier Fourdan
none Details | Review
[PATCH] wayland: do not leak shortcut inhibit data (2.13 KB, patch)
2017-09-12 08:34 UTC, Olivier Fourdan
committed Details | Review
[PATCH v2] wayland: Keep the inhibit shortcut dialog (4.78 KB, patch)
2017-09-12 09:48 UTC, Olivier Fourdan
committed Details | Review

Description Adam Williamson 2017-09-12 01:16:46 UTC
There's some discussion of this in https://bugzilla.gnome.org/show_bug.cgi?id=787240 , but that's really about another crash, so I figure this deserves its own report.

Julian Andres Klode (in #787240), myself and Mikhail Gavrilov (in https://bugzilla.redhat.com/show_bug.cgi?id=1490072 ), and Jean-Baptiste Lallement (in https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1715330 ) have all seen gnome-shell crash this way (taking down our entire sessions, natch) - a segfault in mutter _cogl_boxed_value_set_x , apparently because somehow it's getting called with NULL as its target. Myself, Julian and Mikhail saw it when opening / starting VMs in virt-manager and Boxes; the Ubuntu reproducer seems to possibly involve some kind of Ubuntu-specific update thing, but these are the cited steps:

Test Case:
Pre-requisites: Package update that downloads a payload and download fails (ie flash plugin)
1. Wait until the update-notifier dialog informing the user about the download failure shows up
2. Click on the 'Execute' buitton
3. Enter your credentials
4. Proceed with the download

Expected result
The package is downloaded

Actual result
This crash happens when the authentication window is displayed

Myself, Mikhail and Jean-Baptiste all reported from 3.25.91, but I think Julian may have tested with something more recent. I don't see any changes between 3.25.91 and 3.25.92 which really look like they ought to fix this in any case.
Comment 1 Jonas Ådahl 2017-09-12 04:13:13 UTC
The bug is in gnome-shell, so moving there.
Comment 2 Jonas Ådahl 2017-09-12 04:25:03 UTC
Created attachment 359569 [details] [review]
inhibitShortcuts: Don't destroy actor when hiding

The same dialog can be shown multiple times; to not crash when that
happens we need to avoid destroying the actor when hiding, otherwise
we'll crash when running code that assumes it is still valid.
Comment 3 Jonas Ådahl 2017-09-12 04:27:26 UTC
To actually reproduce this reliably, the patch from bug 787570 is needed. On my set up, this exposes a gtk+/virt-manager bug resulting in the inhibit request being created and destroyed repeatedly.
Comment 4 Jonas Ådahl 2017-09-12 04:28:08 UTC
Uh, must have slipped. Reopening.
Comment 5 Olivier Fourdan 2017-09-12 07:04:47 UTC
The issue is that virt-manager issues a grab() when it gains keyboard focus, and an ungrab() when it loses the keyboard focus.

On Wayland, the grab()/ungrab() being wired to the shortcut inhibit mechanism, which in turn shows the dialog, therefore takes focus away from the virt-manager causes the continuous flickering.

The solution, or at least a compromise, is to keep the dialog around even if the shortcut inhibit is cancelled by the client, so that the user is forced to make a choice that we can reuse on the next request.
Comment 6 Olivier Fourdan 2017-09-12 08:33:34 UTC
Created attachment 359585 [details] [review]
[PATCH] wayland: Keep the inhibit shortcut dialog

On Wayland, the grab()/ungrab() in gtk+/gdk are wired to the shortcut
inhibitor mechanism, which in turn shows the dialog, which can take
focus away from the client window when the dialog is shown.

If the client issues an ungrab() when the keyboard focus is lost, we
would hide the dialog, causing the keyboard focus to be returned to the
client surface, which in turn would issue a new grab(), so forth and so
on, causing a continuous show/hide of the shortcut inhibitor dialog.

To avoid this issue, keep the dialog around even if the shortcut inhibit
is canceled by the client, so that the user is forced to make a choice
that we can reuse on the next request without showing the dialog again.

Instead of hiding the dialog when the shortcut inhibitor is destroyed by
the client, we simply mark the request as canceled and do not apply the
user's choice.
Comment 7 Olivier Fourdan 2017-09-12 08:34:14 UTC
Created attachment 359586 [details] [review]
[PATCH] wayland: do not leak shortcut inhibit data

We would free the shortcut inhibit data only when the client destroys
its request, which is not the case when the clients itself is
destroyed, leading to a leak of the shortcut inhibit data.

Free the data on resource destruction instead, and simply destroy the
resource on destroy request.
Comment 8 Jonas Ådahl 2017-09-12 08:49:34 UTC
Review of attachment 359585 [details] [review]:

Looks good; just one nit about readability.

::: src/wayland/meta-wayland-inhibit-shortcuts-dialog.c
@@ +85,3 @@
+  if (data->request_canceled)
+    return;
+

Would make more sense if you put this condition in the dialog-response function. This being processed from the auto-approve path makes no sense.
Comment 9 Jonas Ådahl 2017-09-12 08:50:15 UTC
Review of attachment 359586 [details] [review]:

LGTM.
Comment 10 Olivier Fourdan 2017-09-12 09:48:34 UTC
Created attachment 359592 [details] [review]
[PATCH v2] wayland: Keep the inhibit shortcut dialog

(In reply to Jonas Ådahl from comment #8)
> Review of attachment 359585 [details] [review] [review]:
> 
> Looks good; just one nit about readability.
> 
> ::: src/wayland/meta-wayland-inhibit-shortcuts-dialog.c
> @@ +85,3 @@
> +  if (data->request_canceled)
> +    return;
> +
> 
> Would make more sense if you put this condition in the dialog-response
> function. This being processed from the auto-approve path makes no sense.

Yeap, that also simplifies the patch...
Comment 11 Jonas Ådahl 2017-09-12 13:04:27 UTC
Review of attachment 359592 [details] [review]:

lgtm.
Comment 12 Olivier Fourdan 2017-09-14 07:36:51 UTC
Comment on attachment 359586 [details] [review]
[PATCH] wayland: do not leak shortcut inhibit data

attachment 359586 [details] [review] pushed to git master as commit 2bf7974 - wayland: do not leak shortcut inhibit data
Comment 13 Olivier Fourdan 2017-09-14 07:37:35 UTC
Comment on attachment 359592 [details] [review]
[PATCH v2] wayland: Keep the inhibit shortcut dialog

attachment 359592 [details] [review] pushed to git master as commit 9c16e4e - wayland: Keep the inhibit shortcut dialog
Comment 14 Olivier Fourdan 2017-10-04 14:26:18 UTC
*** Bug 768959 has been marked as a duplicate of this bug. ***
Comment 15 Daniel van Vugt 2017-11-03 02:48:28 UTC
Those commit NNNN links aren't working. Can someone assign this bug to "mutter" to fix that?