osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41834?usp=email )
Change subject: testenv: fix crash with python 3.14 ......................................................................
testenv: fix crash with python 3.14
Python 3.14 changed the default multiprocessing start method from "fork" to "forkserver", which breaks multiprocessing.Process() as used in testenv.podman.start_in_background(). Restore the previous behavior.
Fix for:
$ ./testenv.py run -n -p -a bts -c generic [testenv] osmo-dev dir: /home/pespin/dev/sysmocom/git/osmo-dev [testenv] Logging to: /tmp/testenv-bts-generic-20260113-1138-f5a1a95e-p7ws27qq [testenv] + ['rm', '/tmp/logs'] [testenv] + ['ln', '-sf', '/tmp/testenv-bts-generic-20260113-1138-f5a1a95e-p7ws27qq', '/tmp/logs'] [testenv] + ['podman', 'image', 'exists', 'debian-trixie-osmo-ttcn3-testenv'] [testenv] + ['podman', 'history', 'debian-trixie-osmo-ttcn3-testenv', '--format', 'json'] [testenv] Image creation date: 2025-12-19 13:01:15 [testenv] Dockerfile last modified: 2025-12-19 12:57:25 [testenv] + ['podman', 'run', '--rm', '--name', 'testenv-bts-generic-20260113-1138-f5a1a95e-0', '--log-driver', 'json-file', '--log-opt', 'path=/tmp/testenv-bts-generic-20260113-1138-f5a1a95e-p7ws27qq/podman/testenv-bts-generic-20260113-1138-f5a1a95e-0.log', '--security-opt=seccomp=/home/pespin/dev/sysmocom/git/osmo-ttcn3-hacks/_testenv/data/podman/seccomp.json', '--cap-add=NET_ADMIN', '--cap-add=NET_RAW', '--cap-add=SYS_ADMIN', '--device=/dev/net/tun', '--volume', '/home/pespin/.cache/osmo-ttcn3-testenv/podman/var-cache-apt-debian-trixie:/var/cache/apt', '--volume', '/home/pespin/.cache/osmo-ttcn3-testenv/podman/var-lib-apt-debian-trixie:/var/lib/apt', '--sysctl', 'net.ipv4.conf.all.send_redirects=0', '--sysctl', 'net.ipv4.conf.default.send_redirects=0', '-e', 'PODMAN=1', '--volume', '/home/pespin/dev/sysmocom/git/osmo-dev:/home/pespin/dev/sysmocom/git/osmo-dev', '--volume', '/tmp/testenv-bts-generic-20260113-1138-f5a1a95e-p7ws27qq:/tmp/testenv-bts-generic-20260113-1138-f5a1a95e-p7ws27qq', '--volume', '/home/pespin/.cache/osmo-ttcn3-testenv:/home/pespin/.cache/osmo-ttcn3-testenv', '--volume', '/home/pespin/.cache/osmo-ttcn3-testenv/ccache:/home/pespin/.cache/osmo-ttcn3-testenv/ccache', '--volume', '/home/pespin/dev/sysmocom/git:/home/pespin/dev/sysmocom/git', 'debian-trixie-osmo-ttcn3-testenv', '/home/pespin/dev/sysmocom/git/osmo-ttcn3-hacks/_testenv/data/scripts/testenv-podman-main.sh'] Running testenv-podman-main.sh usage: testenv.py [-h] {init,run,clean} ... testenv.py: error: the following arguments are required: action [testenv] Stopping podman container [testenv] + ['podman', 'kill', 'testenv-bts-generic-20260113-1138-f5a1a95e-0'] testenv-bts-generic-20260113-1138-f5a1a95e-0 Traceback (most recent call last): File "/home/pespin/dev/sysmocom/git/osmo-ttcn3-hacks/./testenv.py", line 133, in <module> main() ~~~~^^ File "/home/pespin/dev/sysmocom/git/osmo-ttcn3-hacks/./testenv.py", line 122, in main run() ~~~^^ File "/home/pespin/dev/sysmocom/git/osmo-ttcn3-hacks/./testenv.py", line 45, in run testenv.podman.start() ~~~~~~~~~~~~~~~~~~~~^^ File "/home/pespin/dev/sysmocom/git/osmo-ttcn3-hacks/_testenv/testenv/podman.py", line 280, in start start_in_background(cmd) ~~~~~~~~~~~~~~~~~~~^^^^^ File "/home/pespin/dev/sysmocom/git/osmo-ttcn3-hacks/_testenv/testenv/podman.py", line 208, in start_in_background feed_watchdog_process.start() ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.14/multiprocessing/process.py", line 121, in start self._popen = self._Popen(self) ~~~~~~~~~~~^^^^^^ File "/usr/lib/python3.14/multiprocessing/context.py", line 224, in _Popen return _default_context.get_context().Process._Popen(process_obj) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "/usr/lib/python3.14/multiprocessing/context.py", line 300, in _Popen return Popen(process_obj) File "/usr/lib/python3.14/multiprocessing/popen_forkserver.py", line 35, in __init__ super().__init__(process_obj) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "/usr/lib/python3.14/multiprocessing/popen_fork.py", line 20, in __init__ self._launch(process_obj) ~~~~~~~~~~~~^^^^^^^^^^^^^ File "/usr/lib/python3.14/multiprocessing/popen_forkserver.py", line 51, in _launch self.sentinel, w = forkserver.connect_to_new_process(self._fds) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/lib/python3.14/multiprocessing/forkserver.py", line 106, in connect_to_new_process connection.answer_challenge( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ wrapped_client, self._forkserver_authkey) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.14/multiprocessing/connection.py", line 970, in answer_challenge message = connection.recv_bytes(256) # reject large message File "/usr/lib/python3.14/multiprocessing/connection.py", line 222, in recv_bytes buf = self._recv_bytes(maxlength) File "/usr/lib/python3.14/multiprocessing/connection.py", line 447, in _recv_bytes buf = self._recv(4) File "/usr/lib/python3.14/multiprocessing/connection.py", line 412, in _recv chunk = read(handle, to_read) ConnectionResetError: [Errno 104] Connection reset by peer [testenv] Logs saved to: /tmp/testenv-bts-generic-20260113-1138-f5a1a95e-p7ws27qq (symlink: /tmp/logs)
Related: https://docs.python.org/3/whatsnew/3.14.html#multiprocessing Change-Id: I7995916548b27bdaba6a95e4679c5d1dd7caab4c --- M _testenv/testenv.py 1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/34/41834/1
diff --git a/_testenv/testenv.py b/_testenv/testenv.py index 9e33e37..55d7896 100755 --- a/_testenv/testenv.py +++ b/_testenv/testenv.py @@ -2,6 +2,7 @@ # Copyright 2024 sysmocom - s.f.m.c. GmbH # SPDX-License-Identifier: GPL-3.0-or-later import logging +import multiprocessing import os import sys import testenv @@ -114,6 +115,11 @@
def main(): + # Python 3.14 changed the default multiprocessing start method from "fork" + # to "forkserver", which breaks multiprocessing.Process() as used in + # testenv.podman.start_in_background(). Restore the previous behavior. + multiprocessing.set_start_method("fork") + testenv.init_logging() testenv.init_args()