Repository navigation
posix_spawn and posix_spawnp tests failing on NetBSD with stack limit assertions #131624
Description
Activity
- added3.14bugs and security fixesbugs and security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Mar 23, 2025 - added a commit that references this issue
on Mar 23, 2025 - addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Mar 23, 2025 bisect to #130398 CC: @markshannon
Extract of the assertion error:
assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits"Can you dump guard_size, stack_addr, stack_size and here_addr values in _Py_InitializeRecursionLimits()? Example:
diff --git a/Python/ceval.c b/Python/ceval.c index 363f263ad2a..eb5436991e0 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -464,6 +464,7 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate) _tstate->c_stack_soft_limit = base + PYOS_STACK_MARGIN_BYTES * 2; #endif _tstate->c_stack_hard_limit = base + PYOS_STACK_MARGIN_BYTES; +fprintf(stderr, "@@@ stack_size=%zu, guard_size=%zu, stack_addr=%p, here_addr=%p\n", stack_size, guard_size, stack_addr, (void*)here_addr); assert(_tstate->c_stack_soft_limit < here_addr); assert(here_addr < _tstate->c_stack_top); return;
Extract of the assertion error:
assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits"Can you dump guard_size, stack_addr, stack_size and here_addr values in _Py_InitializeRecursionLimits()? Example:
diff --git a/Python/ceval.c b/Python/ceval.c
index 363f263ad2a..eb5436991e0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -464,6 +464,7 @@ _Py_InitializeRecursionLimits(PyThreadState tstate)
_tstate->c_stack_soft_limit = base + PYOS_STACK_MARGIN_BYTES * 2;
#endif
_tstate->c_stack_hard_limit = base + PYOS_STACK_MARGIN_BYTES;
+fprintf(stderr, "@@@ stack_size=%zu, guard_size=%zu, stack_addr=%p, here_addr=%p\n", stack_size, guard_size, stack_addr, (void)here_addr);
assert(_tstate->c_stack_soft_limit < here_addr);
assert(here_addr < _tstate->c_stack_top);
return;╰─$ ./python -m test test_posix -m TestPosixSpawn -m TestPosixSpawnP -v @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff7bb000, here_addr=0x7f7fffbb8240 == CPython 3.14.0a6+ (heads/main-dirty:a1232459860, Mar 25 2025, 19:00:35) [GCC 10.5.0] == NetBSD-10.0-amd64-x86_64-64bit-ELF little-endian == Python build: debug == cwd: /home/blue/cpython/build/test_python_worker_12945æ == CPU count: 16 == encodings: locale=UTF-8 FS=utf-8 == resources: all test resources are disabled, use -u option to unskip tests Using random seed: 692812059 0:00:00 load avg: 3.16 Run 1 test sequentially in a single process 0:00:00 load avg: 3.16 [1/1] test_posix test_bad_file_actions (test.test_posix.TestPosixSpawn.test_bad_file_actions) ... ok test_close_file (test.test_posix.TestPosixSpawn.test_close_file) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff6b2000, here_addr=0x7f7fff4887d0 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL test_dup2 (test.test_posix.TestPosixSpawn.test_dup2) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff6b2000, here_addr=0x7f7fff618f10 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL test_empty_file_actions (test.test_posix.TestPosixSpawn.test_empty_file_actions) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff6b2000, here_addr=0x7f7fffbed3e0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_multiple_file_actions (test.test_posix.TestPosixSpawn.test_multiple_file_actions) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff6b2000, here_addr=0x7f7fff6dcc70 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL test_no_such_executable (test.test_posix.TestPosixSpawn.test_no_such_executable) ... ok test_none_file_actions (test.test_posix.TestPosixSpawn.test_none_file_actions) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff6b2000, here_addr=0x7f7fffb67330 ok test_open_file (test.test_posix.TestPosixSpawn.test_open_file) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff6b2000, here_addr=0x7f7fffd0c500 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_resetids (test.test_posix.TestPosixSpawn.test_resetids) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fff8e2c20 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_resetids_explicit_default (test.test_posix.TestPosixSpawn.test_resetids_explicit_default) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fffb71de0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_returns_pid (test.test_posix.TestPosixSpawn.test_returns_pid) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fff03be60 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL test_setpgroup (test.test_posix.TestPosixSpawn.test_setpgroup) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fff406e70 ok test_setpgroup_wrong_type (test.test_posix.TestPosixSpawn.test_setpgroup_wrong_type) ... ok test_setscheduler_only_param (test.test_posix.TestPosixSpawn.test_setscheduler_only_param) ... skipped 'bpo-34685: test can fail on BSD' test_setscheduler_with_policy (test.test_posix.TestPosixSpawn.test_setscheduler_with_policy) ... skipped 'bpo-34685: test can fail on BSD' test_setsid (test.test_posix.TestPosixSpawn.test_setsid) ... skipped "setsid is not supported: NotImplementedError('posix_spawn: setsid unavailable on this platform')" test_setsigdef (test.test_posix.TestPosixSpawn.test_setsigdef) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fff9d7890 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_setsigdef_wrong_type (test.test_posix.TestPosixSpawn.test_setsigdef_wrong_type) ... ok test_setsigmask (test.test_posix.TestPosixSpawn.test_setsigmask) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fff482bf0 ok test_setsigmask_wrong_type (test.test_posix.TestPosixSpawn.test_setsigmask_wrong_type) ... ok test_specify_environment (test.test_posix.TestPosixSpawn.test_specify_environment) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fffb77ac0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_bad_file_actions (test.test_posix.TestPosixSpawnP.test_bad_file_actions) ... ok test_close_file (test.test_posix.TestPosixSpawnP.test_close_file) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffefd8000, here_addr=0x7f7fff1aee60 ok test_dup2 (test.test_posix.TestPosixSpawnP.test_dup2) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff079000, here_addr=0x7f7fff2191f0 ok test_empty_file_actions (test.test_posix.TestPosixSpawnP.test_empty_file_actions) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff079000, here_addr=0x7f7fff63a300 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_multiple_file_actions (test.test_posix.TestPosixSpawnP.test_multiple_file_actions) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff079000, here_addr=0x7f7ffffc09f0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_no_such_executable (test.test_posix.TestPosixSpawnP.test_no_such_executable) ... ok test_none_file_actions (test.test_posix.TestPosixSpawnP.test_none_file_actions) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff079000, here_addr=0x7f7fff998ee0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_open_file (test.test_posix.TestPosixSpawnP.test_open_file) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff079000, here_addr=0x7f7fffc34930 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_posix_spawnp (test.test_posix.TestPosixSpawnP.test_posix_spawnp) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff673000, here_addr=0x7f7fffa704e0 ok test_resetids (test.test_posix.TestPosixSpawnP.test_resetids) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff9c9000, here_addr=0x7f7fffebbbd0 ok test_resetids_explicit_default (test.test_posix.TestPosixSpawnP.test_resetids_explicit_default) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff9c9000, here_addr=0x7f7fff604700 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL test_returns_pid (test.test_posix.TestPosixSpawnP.test_returns_pid) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff9c9000, here_addr=0x7f7fff794ad0 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL test_setpgroup (test.test_posix.TestPosixSpawnP.test_setpgroup) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff9c9000, here_addr=0x7f7fff40dda0 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL test_setpgroup_wrong_type (test.test_posix.TestPosixSpawnP.test_setpgroup_wrong_type) ... ok test_setscheduler_only_param (test.test_posix.TestPosixSpawnP.test_setscheduler_only_param) ... skipped 'bpo-34685: test can fail on BSD' test_setscheduler_with_policy (test.test_posix.TestPosixSpawnP.test_setscheduler_with_policy) ... skipped 'bpo-34685: test can fail on BSD' test_setsid (test.test_posix.TestPosixSpawnP.test_setsid) ... skipped "setsid is not supported: NotImplementedError('posix_spawnp: setsid unavailable on this platform')" test_setsigdef (test.test_posix.TestPosixSpawnP.test_setsigdef) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff9c9000, here_addr=0x7f7ffff2bac0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" FAIL test_setsigdef_wrong_type (test.test_posix.TestPosixSpawnP.test_setsigdef_wrong_type) ... ok test_setsigmask (test.test_posix.TestPosixSpawnP.test_setsigmask) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff9c9000, here_addr=0x7f7fffe9e820 ok test_setsigmask_wrong_type (test.test_posix.TestPosixSpawnP.test_setsigmask_wrong_type) ... ok test_specify_environment (test.test_posix.TestPosixSpawnP.test_specify_environment) ... @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff9c9000, here_addr=0x7f7fff36bbd0 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" FAIL ====================================================================== FAIL: test_close_file (test.test_posix.TestPosixSpawn.test_close_file) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 2087, in test_close_file support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 5945 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_dup2 (test.test_posix.TestPosixSpawn.test_dup2) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 2105, in test_dup2 support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 1255 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_empty_file_actions (test.test_posix.TestPosixSpawn.test_empty_file_actions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1842, in test_empty_file_actions support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 9865 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_multiple_file_actions (test.test_posix.TestPosixSpawn.test_multiple_file_actions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 2021, in test_multiple_file_actions support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 26380 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_open_file (test.test_posix.TestPosixSpawn.test_open_file) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 2068, in test_open_file support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 23922 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_resetids (test.test_posix.TestPosixSpawn.test_resetids) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1860, in test_resetids support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 29780 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_resetids_explicit_default (test.test_posix.TestPosixSpawn.test_resetids_explicit_default) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1851, in test_resetids_explicit_default support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 4181 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_returns_pid (test.test_posix.TestPosixSpawn.test_returns_pid) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1792, in test_returns_pid support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 9818 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_setsigdef (test.test_posix.TestPosixSpawn.test_setsigdef) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1955, in test_setsigdef support.wait_process(pid, exitcode=-signal.SIGUSR1) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 21767 exited with code -6, but exit code -30 is expected ====================================================================== FAIL: test_specify_environment (test.test_posix.TestPosixSpawn.test_specify_environment) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1822, in test_specify_environment support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 16068 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_empty_file_actions (test.test_posix.TestPosixSpawnP.test_empty_file_actions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1842, in test_empty_file_actions support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 1453 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_multiple_file_actions (test.test_posix.TestPosixSpawnP.test_multiple_file_actions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 2021, in test_multiple_file_actions support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 15889 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_none_file_actions (test.test_posix.TestPosixSpawnP.test_none_file_actions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1833, in test_none_file_actions support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 4565 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_open_file (test.test_posix.TestPosixSpawnP.test_open_file) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 2068, in test_open_file support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 2565 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_resetids_explicit_default (test.test_posix.TestPosixSpawnP.test_resetids_explicit_default) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1851, in test_resetids_explicit_default support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 27585 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_returns_pid (test.test_posix.TestPosixSpawnP.test_returns_pid) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1792, in test_returns_pid support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 1509 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_setpgroup (test.test_posix.TestPosixSpawnP.test_setpgroup) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1869, in test_setpgroup support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 19011 exited with code -6, but exit code 0 is expected ====================================================================== FAIL: test_setsigdef (test.test_posix.TestPosixSpawnP.test_setsigdef) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1955, in test_setsigdef support.wait_process(pid, exitcode=-signal.SIGUSR1) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 22118 exited with code -6, but exit code -30 is expected ====================================================================== FAIL: test_specify_environment (test.test_posix.TestPosixSpawnP.test_specify_environment) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/blue/cpython/Lib/test/test_posix.py", line 1822, in test_specify_environment support.wait_process(pid, exitcode=0) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/blue/cpython/Lib/test/support/__init__.py", line 2241, in wait_process raise AssertionError(f"process {pid} exited with code {exitcode2}, " f"but exit code {exitcode} is expected") AssertionError: process 4931 exited with code -6, but exit code 0 is expected ---------------------------------------------------------------------- Ran 43 tests in 3.160s FAILED (failures=19, skipped=6) Warning -- files was modified by test_posix Warning -- Before: [] Warning -- After: ['python.core'] test test_posix failed 0:00:03 load avg: 3.16 [1/1/1] test_posix failed (19 failures) == Tests result: FAILURE == 1 test failed: test_posix Total duration: 3.7 sec Total tests: run=43 (filtered) failures=19 skipped=6 Total test files: run=1/1 (filtered) failed=1 Result: FAILURE
without verbose;
╰─$ ./python -m test test_posix -m TestPosixSpawn -m TestPosixSpawnP @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff0b0000, here_addr=0x7f7fff4ada60 Using random seed: 400541714 0:00:00 load avg: 1.07 Run 1 test sequentially in a single process 0:00:00 load avg: 1.07 [1/1] test_posix @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff63b000, here_addr=0x7f7fff5c7cd0 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff7fe000, here_addr=0x7f7fff303be0 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffadbf50 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fff793140 @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffcffa70 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffc57eb0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fff7418b0 @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fff30f920 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffa98760 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffe09510 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffa21cb0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffc60980 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fff1f6a70 assertion "_tstate->c_stack_soft_limit < here_addr" failed: file "Python/ceval.c", line 468, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fff89ee90 @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7ffff64d40 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffc23700 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fff65a3a0 @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffe7e6a0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff442000, here_addr=0x7f7fffa3e370 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff23c000, here_addr=0x7f7fff6390a0 @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffed89000, here_addr=0x7f7fff7c1640 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffed89000, here_addr=0x7f7fff4624c0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffed89000, here_addr=0x7f7fffe61a90 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffed89000, here_addr=0x7f7fff45b8e0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffed89000, here_addr=0x7f7fff682690 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffed89000, here_addr=0x7f7fffe66900 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" @@@ stack_size=4194304, guard_size=1048576, stack_addr=0x7f7ffed89000, here_addr=0x7f7fffc383c0 assertion "here_addr < _tstate->c_stack_top" failed: file "Python/ceval.c", line 469, function "_Py_InitializeRecursionLimits" Warning -- files was modified by test_posix Warning -- Before: [] Warning -- After: ['posix_spawnp_tes.core', 'python.core'] test test_posix failed -- multiple errors occurred; run in verbose mode for details 0:00:02 load avg: 1.07 [1/1/1] test_posix failed (23 failures) == Tests result: FAILURE == 1 test failed: test_posix Total duration: 2.7 sec Total tests: run=43 (filtered) failures=23 skipped=6 Total test files: run=1/1 (filtered) failed=1 Result: FAILURE
stack_size=4194304, guard_size=1048576, stack_addr=0x7f7fff6b2000, here_addr=0x7f7fff6dcc70guard_size is quite big, it's 1 MiB.
>>> stack_addr = 0x7f7fff6b2000 >>> here_addr = 0x7f7fff6dcc70 >>> guard_size=1048576 >>> base = stack_addr + guard_size >>> c_stack_soft_limit = base + 4096*8 * 2 >>> c_stack_soft_limit < here_addr False- added a commit that references this issue
on Mar 29, 2025 - added a commit that references this issue
on Apr 12, 2025 Would changing the value of PYOS_STACK_MARGIN help?
No, changing PYOS_STACK_MARGIN does not help.
The difference between
here_addrandbasevaries in a wide range -- from about -5_000_000 to 15_000_000. It can be negative or exceedstack_sizeby far.stack_addris often repeated from test to test, buthere_addrvaries in a wide range. If any of these values was completely random, we would expect a wider ranger (in full 64 bits), so there must be some relation between them, but it differs from expected.Note that there was a bug in handling the guard area which was fixed only recently (see https://gnats.netbsd.org/57721). It is possible that there are other bugs left.
In any case, until we find the root of the issue (being it our misuse or the NetBSD bug), PR #131625 looks like a correct workaround.
Reacted by Furkan Onder- added a commit that references this issue
on Apr 13, 2025
Bug report
Bug description:
Multiple tests in
test_posixforposix_spawnandposix_spawnpfunctionality are failing on NetBSD with stack limit-related assertions in the spawned processes. All failing tests show child processes exiting with code -6 (SIGABRT).Environment
CPython version: 3.14.0a6+ (heads/main:557d2d20d48, Mar 23 2025)
Platform: NetBSD-10.0-amd64-x86_64-64bit-ELF little-endian
Build Flags:
--with-debugTests
./python -m test test_posix -m TestPosixSpawn -m TestPosixSpawnP -vOutput:
CPython versions tested on:
CPython main branch, 3.14
Operating systems tested on:
Other
Linked PRs