bulletmark / libinput-gestures

Actions gestures on your touchpad using libinput

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

there is a zombie process

haolian9 opened this issue · comments

> libinput-gestures -l
libinput-gestures: session i3+x11 on Linux-5.17.5-zen1-1-zen-x86_64-with-glibc2.35, python 3.10.4, libinput 1.20.1
Hash: 40fbc7bf6f74dfec892301edf07949e5
Gestures configured in ~/.config/libinput-gestures.conf:
swipe up         4 xdotool key super+k
swipe down       4 xdotool key super+j
swipe left       4 xdotool key super+h
swipe right      4 xdotool key super+l
swipe left       3 ~/.config/libinput-gestures/scripts/browser_history.sh --back
swipe right      3 ~/.config/libinput-gestures/scripts/browser_history.sh --forward
libinput-gestures: device /dev/input/by-path/platform-i8042-serio-1-event-mouse(event17): ETPS/2 Elantech Touchpad
libinput-gestures is installed.
libinput-gestures is set up as a desktop application.
libinput-gestures is currently running as a desktop application.
libinput-gestures is set to autostart as a desktop application.
libinput-gestures is using custom configuration file.

Describe the issue

each time i triggered a gesture, libinput-gestures will left a zombie comes from handler of the gesture. but luckily, the number of zombie is never greater than 1.

the zombie can be seen by this command:

> ps -o pid,ppid,lstart,cmd --ppid $(pgrep -f gestures)
    PID    PPID                  STARTED CMD
 277034  277030 Wed May 11 20:53:43 2022 libinput-debug-events --device /dev/in
 277044  277030 Wed May 11 20:53:47 2022 [xdotool] <defunct>

i have read some code of libinput-gestures, and i think the zombie could be created by def run(cmd, *, check=True, block=True):: when block=False, Popen.__exit__ or Popen.wait will never be called. though i did not figured out why the number of zombie not increases, i have added a line signal.signal(signal.SIGCHLD, lambda *args: os.waitpid(-1, 0)) to solve this problem which just works.

This issue was raised as PR #242 over 2 years ago. I merged that PR but immediately issue #259 was raised so I reverted the PR with commit a77c0d5. As I said in that commit, there is only at most one defunct process left around so it is just not a practical problem.

according to ma 7 signal

SIGCHLD P1990 Ign Child stopped or terminated

i suspect that signal.signal(signal.SIGCHLD, signal.SIG_IGN) will work as expectd (i have not tested it), and it obviously is not identical to signal.signal(signal.SIGCHLD, lambda *args: os.waitpid(-1, 0)).

anyway, i agree with the a77c0d5; sorry about the noice. (i just searched the issue but not the pr)

zombie back?

kearney@82dm ~]$ libinput-gestures -l
libinput-gestures: session KDE+x11 on Linux-6.2.9-arch1-1-x86_64-with-glibc2.37, python 3.10.10, libinput 1.23.0
Hash: 1cfe6ad528f2202a483fea24b3cd7f47
Gestures configured in ~/.config/libinput-gestures.conf:
swipe up         3 xdotool key ctrl+F8
swipe down       3 xdotool key ctrl+F10
swipe left       3 xdotool key Ctrl+F2
swipe right      3 xdotool key Ctrl+F1
pinch in         2 xdotool key ctrl+minus
pinch out        2 xdotool key ctrl+plus
libinput-gestures: device /dev/input/by-path/platform-AMDI0010:02-event-mouse(event6): MSFT0001:00 06CB:CD3E Touchpad
libinput-gestures is installed.
libinput-gestures is set up as a desktop application.
libinput-gestures is currently running as a desktop application.
libinput-gestures is set to autostart as a desktop application.
libinput-gestures is using custom configuration file.
[kearney@82dm ~]$ ps -o pid,ppid,lstart,cmd --ppid $(pgrep -f gestures)
    PID    PPID                  STARTED CMD
   1035     894 Tue Apr  4 14:00:19 2023 libinput-debug-events --device /dev/input/by-path/platform-AMDI0010:02-event-mouse
   5304     894 Tue Apr  4 15:36:29 2023 [xdotool] <defunct>
[kearney@82dm ~]$ ps aux | awk '$8 ~ /^[Zz]/'
kearney     5304  0.0  0.0      0     0 ?        Z    15:36   0:00 [xdotool] <defunct>

@BackMountainDevil please read my last comment above.