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 767464 - [Wayland] Force quit dialog (sometimes?) doesn't work
[Wayland] Force quit dialog (sometimes?) doesn't work
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks: WaylandRelated
 
 
Reported: 2016-06-09 16:54 UTC by Michael Catanzaro
Modified: 2016-06-10 09:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] wayland: Implement force-quit using kill() (1.90 KB, patch)
2016-06-10 07:35 UTC, Olivier Fourdan
none Details | Review
[PATCH] wayland: Implement force-quit using kill() (1.92 KB, patch)
2016-06-10 07:56 UTC, Olivier Fourdan
committed Details | Review

Description Michael Catanzaro 2016-06-09 16:54:52 UTC
Today Boxes hung. mutter displayed the force quit dialog, and I clicked force quit. Nothing happened. Some time later, mutter displayed the dialog again, and I clicked force quit again. I did this four times before giving up and sending SIGTERM.

Now, I sent SIGTERM manually and it did not work, so Boxes was surely blocking SIGTERM. Finally, I sent SIGKILL and it worked. I'm not sure if that's relevant, though, because Owen says he thinks force quit just might not be implemented at all on Wayland.
Comment 1 Olivier Fourdan 2016-06-09 18:16:58 UTC
I think force quite wires to a Wayland protocol error that kills the client.

https://git.gnome.org/browse/mutter/tree/src/wayland/meta-window-wayland.c#n100
Comment 2 Michael Catanzaro 2016-06-09 20:03:26 UTC
(In reply to Olivier Fourdan from comment #1)
> I think force quite wires to a Wayland protocol error that kills the client.
> 
> https://git.gnome.org/browse/mutter/tree/src/wayland/meta-window-wayland.
> c#n100

I guess that doesn't work if the client is hung.
Comment 3 Olivier Fourdan 2016-06-10 07:33:36 UTC
(In reply to Michael Catanzaro from comment #2)
> I guess that doesn't work if the client is hung.

Yeah, the X11 backend will kill the client using its PID (that it got from _NET_WM_PID for apps that implement the EWMH), whereas the Wayland backend relies on Wayland a protocol error to terminate the client...
Comment 4 Olivier Fourdan 2016-06-10 07:35:27 UTC
Created attachment 329533 [details] [review]
[PATCH] wayland: Implement force-quit using kill()

The X11 backend uses EWMH's _NET_WM_PID to get the PID of an offending
client and kill its PID to force the client to terminate.

The Wayland backend is using a Wayland protocol error, but if the client
is hung, that will not be sufficient to kill the client.

Retrieve the client PID under Wayland using the Wayland client API
wl_client_get_credentials() and kill() the client the same way the X11
backend does.
Comment 5 Florian Müllner 2016-06-10 07:42:06 UTC
Review of attachment 329533 [details] [review]:

::: src/wayland/meta-window-wayland.c
@@ +116,3 @@
+                  window->desc);
+
+      if (kill (pid, 9) < 0)

Maybe use
if (kill (pid, 9) == 0)
  return;

meta_topic(...);

It is a bit odd to try sending an error to client we know we just killed successfully ...
Comment 6 Olivier Fourdan 2016-06-10 07:52:15 UTC
(In reply to Florian Müllner from comment #5)
> It is a bit odd to try sending an error to client we know we just killed
> successfully ...

Yeah, but that's what the X11 backend does:

https://git.gnome.org/browse/mutter/tree/src/x11/window-x11.c#n701

It kill() the client and then XKillClient(), I was trying to remain consistent in the oddities :)
Comment 7 Florian Müllner 2016-06-10 07:55:44 UTC
(In reply to Olivier Fourdan from comment #6)
> I was trying to remain consistent in the oddities :)

Weird, but OK then :-)
Comment 8 Olivier Fourdan 2016-06-10 07:56:39 UTC
Created attachment 329535 [details] [review]
[PATCH] wayland: Implement force-quit using kill()

v2: return if kill() succeeded
Comment 9 Florian Müllner 2016-06-10 08:08:04 UTC
Review of attachment 329535 [details] [review]:

Either version looks fine to me, I'll leave it to you to push the patch you prefer.
Comment 10 Olivier Fourdan 2016-06-10 08:17:31 UTC
Then let's pick that last one then.

One more question, do you want me to cherry-pick it and push it in branch gnome-3-20 as well or you'll do it?
Comment 11 Florian Müllner 2016-06-10 08:30:38 UTC
(In reply to Olivier Fourdan from comment #10)
> do you want me to cherry-pick it and push it in branch
> gnome-3-20 as well or you'll do it?

I'm heading to the office now. If you haven't pushed it to the stable branch by then, I'll do it.
Comment 12 Olivier Fourdan 2016-06-10 08:33:50 UTC
Comment on attachment 329535 [details] [review]
[PATCH] wayland: Implement force-quit using kill()

attachment 329535 [details] [review] pushed to branch master as commit c72efc9 - wayland: Implement force-quit using kill()
Comment 13 Olivier Fourdan 2016-06-10 08:34:38 UTC
(In reply to Florian Müllner from comment #11)
> I'm heading to the office now. If you haven't pushed it to the stable branch
> by then, I'll do it.

OK, I'll leave it to you for the stable branch then, I've pushed only to the master branch.