hardpixel / unite-shell

Unite is an extension that makes GNOME Shell look like Ubuntu Unity Shell.
GNU General Public License v3.0
903 stars 61 forks source link

xprop zombie processes #323

Open ces42 opened 1 year ago

ces42 commented 1 year ago

Describe the bug This extension does not reap the xprop processes used to remove decorations from maximized or tiled window.

To Reproduce Steps to reproduce the behavior:

  1. Set the "Hide window titlebars" to "maximixed".
  2. Maximized and unmaximize a window a couple of times
  3. Check htop for xprop zombie processes

Expected behavior The extension should ensure that xprop processes are reaped

Environment (please complete the following information):

Additional context The xprop process is started in https://github.com/hardpixel/unite-shell/blob/eb8bdd3d1748a10b8ce7d217d72398ee5e3c4263/unite%40hardpixel.eu/window.js#L41 and it turns out that gnome's Util.spawn adds the DO_NOT_REAP_CHILD flag when starting a process (see here). Further down in that function an exit handler is attached for the process, which I think is supposed to take care of reaping the child? But maybe what's happening is that the xprop process finishes before the handler is attached?

A possible fix here might be to just directly call

GLib.spawn_async(null,
                 ['xprop', '-id', xid, '-f', hint, '32c', '-set', hint, value],
                 null,
                 GLib.SpawnFlags.SEARCH_PATH,
                 () => {
                    try {
                        global.context.restore_rlimit_nofile();
                    } catch (err) {
                    }
                 }
    )