GNOME Bugzilla – Bug 767464
[Wayland] Force quit dialog (sometimes?) doesn't work
Last modified: 2016-06-10 09:52:47 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.
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
(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.
(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...
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.
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 ...
(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 :)
(In reply to Olivier Fourdan from comment #6) > I was trying to remain consistent in the oddities :) Weird, but OK then :-)
Created attachment 329535 [details] [review] [PATCH] wayland: Implement force-quit using kill() v2: return if kill() succeeded
Review of attachment 329535 [details] [review]: Either version looks fine to me, I'll leave it to you to push the patch you prefer.
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?
(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 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()
(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.