Bug report
When regrtest has to kill a worker process on OpenBSD — on timeout, or on Ctrl-C — it fails with PermissionError instead, and the whole run ends with a worker bug:
Warning -- File "Lib/test/libregrtest/run_workers.py", line 204, in _run_process
Warning -- self._kill()
Warning -- File "Lib/test/libregrtest/run_workers.py", line 151, in _kill
Warning -- sid = os.getsid(popen.pid)
Warning -- PermissionError: [Errno 1] Operation not permitted
== Tests result: FAILURE, WORKER BUG ==
_kill() compares the session of the worker with its own to decide whether to kill the whole process group:
if use_killpg:
parent_sid = os.getsid(0)
sid = os.getsid(popen.pid)
use_killpg = (sid != parent_sid)
But POSIX allows getsid() to fail with EPERM if the process is not in the same session as the caller, and OpenBSD does exactly that. Worker processes are started with start_new_session=True, so they are never in the same session:
start_new_session=False -> sid=96067 (mine=96067)
start_new_session=True -> OSError errno=1 Operation not permitted
The error therefore answers the very question being asked: the worker is in a different session, so its process group can be killed.
Since this runs on every kill, killing a worker has never worked on OpenBSD since process groups were introduced in bpo-38502. Both --timeout and Ctrl-C take the whole run down instead of stopping the single test, which is the opposite of what that machinery is for. test_regrtest fails for this reason.
The comparison cannot simply be dropped: tests that need a TTY are deliberately started without a new session (NEED_TTY), and killing their process group would kill regrtest itself.
Linked PRs
Bug report
When regrtest has to kill a worker process on OpenBSD — on timeout, or on Ctrl-C — it fails with
PermissionErrorinstead, and the whole run ends with a worker bug:_kill()compares the session of the worker with its own to decide whether to kill the whole process group:But POSIX allows
getsid()to fail withEPERMif the process is not in the same session as the caller, and OpenBSD does exactly that. Worker processes are started withstart_new_session=True, so they are never in the same session:The error therefore answers the very question being asked: the worker is in a different session, so its process group can be killed.
Since this runs on every kill, killing a worker has never worked on OpenBSD since process groups were introduced in bpo-38502. Both
--timeoutand Ctrl-C take the whole run down instead of stopping the single test, which is the opposite of what that machinery is for.test_regrtestfails for this reason.The comparison cannot simply be dropped: tests that need a TTY are deliberately started without a new session (
NEED_TTY), and killing their process group would kill regrtest itself.Linked PRs