pyauth / python-pkcs11

PKCS#11/Cryptoki support for Python
MIT License
150 stars 71 forks source link

segfaulting only on github action #171

Open kushaldas opened 9 months ago

kushaldas commented 9 months ago

I am having a corner case where while generating RSA keys (using softhsm2) on Bookwork python images on github action (3rd key generation in the tests) it is segfaulting. Happening across various Python versions. If I run only the affected tests, then no issues. The tests are running happily in the local system. Any tips?

Fatal Python error: Segmentation fault

Thread 0x00007f57077646c0 (most recent call first):
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 89 in _worker
  File "/usr/local/lib/python3.12/threading.py", line 1010 in run
  File "/usr/local/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/usr/local/lib/python3.12/threading.py", line 1030 in _bootstrap

Current thread 0x00007f570a3dcb80 (most recent call first):
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pkcs11/types.py", line 509 in generate_keypair
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/src/python_x509_pkcs11/pkcs11_handle.py", line 526 in create_keypair
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88 in _run
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1985 in _run_once
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639 in run_forever
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672 in run_until_complete
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118 in run
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194 in run
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/tests/test_privatekeys.py", line 42 in test_rsa_private_key
  File "/usr/local/lib/python3.12/unittest/case.py", line 589 in _callTestMethod
  File "/usr/local/lib/python3.12/unittest/case.py", line 634 in run
  File "/usr/local/lib/python3.12/unittest/case.py", line 690 in __call__
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/unittest.py", line 338 in runtest
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/runner.py", line 174 in pytest_runtest_call
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 102 in _multicall
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 119 in _hookexec
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 501 in __call__
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/runner.py", line 267 in <lambda>
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/runner.py", line 346 in from_call
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/runner.py", line 266 in call_runtest_hook
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/runner.py", line 227 in call_and_report
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/runner.py", line 134 in runtestprotocol
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/runner.py", line 115 in pytest_runtest_protocol
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 102 in _multicall
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 119 in _hookexec
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 501 in __call__
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/main.py", line 352 in pytest_runtestloop
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 102 in _multicall
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 119 in _hookexec
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 501 in __call__
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/main.py", line 327 in _main
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/main.py", line 273 in wrap_session
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/main.py", line 320 in pytest_cmdline_main
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 102 in _multicall
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 119 in _hookexec
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 501 in __call__
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 175 in main
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 198 in console_main
  File "/__w/python_x509_pkcs11/python_x509_pkcs11/.venv/bin/pytest", line 8 in <module>

Extension modules: multidict._multidict, yarl._quoting_c, aiohttp._helpers, aiohttp._http_writer, aiohttp._http_parser, aiohttp._websocket, frozenlist._frozenlist, _cffi_backend, pkcs11._pkcs11 (total: 9)
Segmentation fault (core dumped)
tests/test_privatekeys.py::TestPrivateKeys::test_rsa_private_key