fix: killpg permission error on macos
Behavior of killpg
slightly differs in Mac and Linux. For some reason,
killpg
returns error EPERM when sending a signal to a zomibie process.
And that is the reason of test_process_management
failure on mac -
there's a small gap between killing a child and and subreaper calling
waitpid
.
Now pytest handles this exception properly.
Close #70 (closed)
See also:
-
Stackoverflow: Why would
killpg
return "not permitted" when ownership is correct? https://stackoverflow.com/questions/12521705/why-would-killpg-return-not-permitted-when-ownership-is-correct -
Linux
man 2 killpg
: https://linux.die.net/man/2/killpg#NotesNotes
There are various differences between the permission checking in BSD-type systems and System V-type systems. See the POSIX rationale for kill(). A difference not mentioned by POSIX concerns the return value EPERM: BSD documents that no signal is sent and EPERM returned when the permission check failed for at least one target process, while POSIX documents EPERM only when the permission check failed for all target processes.
-
MacOS
man 2 killpg
: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/killpg.2.html[EPERM] The sending process is not the super-user and one or more of the target processes has an effective user ID different from that of the sending process.
-
Linux
man 2 kill
: https://linux.die.net/man/2/killEPERM The process does not have permission to send the signal to any of the target processes.
-
Process states in Linux: https://kerneltalks.com/linux/process-states-in-linux/
-
Reproduce killpg returning EPERM on MacOS: https://git.picodata.io/picodata/picodata/picodata/-/snippets/7