In the GitHub Actions ubuntu-latest runner, I am getting a segmentation fault while running some of my Python tests using Pytest.
Run xvfb-run pytest on the GitHub Actions CI, below with gdb debugging:
(Gaphor) runner@fv-az76:~/work/gaphor/gaphor$ gdb -ex r --args python -m pytest GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> Starting program: /home/runner/work/gaphor/gaphor/.venv/bin/python -m pytest [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [Detaching after fork from child process 7738] [Detaching after fork from child process 7740] [Detaching after fork from child process 7741] [Detaching after fork from child process 7742] ============================================= test session starts ============================================== platform linux -- Python 3.8.0, pytest-5.3.0, py-1.8.0, pluggy-0.13.1 rootdir: /home/runner/work/gaphor/gaphor, inifile: pytest.ini, testpaths: gaphor, tests, docs plugins: xvfb-1.2.0, cov-2.8.1 collecting ... [New Thread 0x7fffe1493700 (LWP 7755)] [New Thread 0x7fffe0c92700 (LWP 7756)] [Detaching after fork from child process 7757] collecting 224 items Thread 1 "python" received signal SIGSEGV, Segmentation fault. PyModule_GetState (m=0x0) at Objects/moduleobject.c:565 565 Objects/moduleobject.c: No such file or directory.
The issue is isolated to some of the doctests and a couple of test modules that call the pydoc module. As you can see above the seg fault occurs while collecting the tests. I can get the tests to pass once I remove doctest and the other test modules.
I do not get any errors when running the same tests using windows-latest or macos-latest. I do not get the errors locally in Ubuntu, or when using Ubuntu in Azure Pipelines.
I have tried both Python 3.7 and 3.8, I get the segmentation faults for both cases. The errors happen with multiple versions of Pytest, including 4.x and 5.x releases.
Because the error is pointing to an issue with Objects/moduleobject.c missing, I think this must be an issue with the Python installed on the ubuntu runners. If anyone has any other ideas on how to further isolate root cause, I would be glad to perform those actions as well.