-
-
Notifications
You must be signed in to change notification settings - Fork 602
Closed
Description
I was getting a segfault when attempting to use jsonschema v4.25.1 (latest release) and rpds-py v0.8.10.
Click to see segfault logs
➜ PYTHONFAULTHANDLER=1 trial tests.util.test_check_dependencies.TestDependencyChecker
Fatal Python error: Segmentation fault
Current thread 0x00007f46593c3740 [python3.14] (most recent call first):
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/jsonschema/_types.py", line 23 in _typed_map_converter
File "<attrs generated methods jsonschema._types.TypeChecker>", line 14 in __init__
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/jsonschema/_types.py", line 182 in <module>
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 762 in exec_module
File "<frozen importlib._bootstrap>", line 938 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1342 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/jsonschema/__init__.py", line 14 in <module>
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 762 in exec_module
File "<frozen importlib._bootstrap>", line 938 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1342 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "/home/work/code/synapse/synapse/config/_util.py", line 23 in <module>
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 762 in exec_module
File "<frozen importlib._bootstrap>", line 938 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1342 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "/home/work/code/synapse/synapse/config/api.py", line 27 in <module>
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 762 in exec_module
File "<frozen importlib._bootstrap>", line 938 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1342 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "/home/work/code/synapse/synapse/config/homeserver.py", line 24 in <module>
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 762 in exec_module
File "<frozen importlib._bootstrap>", line 938 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1342 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "/home/work/code/synapse/tests/unittest.py", line 64 in <module>
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 762 in exec_module
File "<frozen importlib._bootstrap>", line 938 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1342 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "/home/work/code/synapse/tests/util/test_check_dependencies.py", line 36 in <module>
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 762 in exec_module
File "<frozen importlib._bootstrap>", line 938 in _load_unlocked
File "<frozen importlib._bootstrap>", line 1342 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "<frozen importlib._bootstrap>", line 491 in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1314 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1371 in _find_and_load
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/twisted/python/reflect.py", line 156 in namedModule
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/twisted/trial/runner.py", line 474 in findByName
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/twisted/trial/runner.py", line 711 in loadByName
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/twisted/trial/runner.py", line 730 in loadByNames
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/twisted/scripts/trial.py", line 571 in _getSuite
File "/home/work/code/synapse/.venv/lib/python3.14/site-packages/twisted/scripts/trial.py", line 680 in run
File "/home/work/code/synapse/.venv/bin/trial", line 8 in <module>
Current thread's C stack trace (most recent call first):
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _Py_DumpStack+0x49 [0x7f4658f498c9]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x367d9c [0x7f4658f67d9c]
Binary file "/nix/store/qhw0sp183mqd04x5jp75981kwya64npv-glibc-2.40-66/lib/libc.so.6", at +0x419c0 [0x7f46588419c0]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at PyObject_Hash+0x7 [0x7f4658d8d887]
Binary file "/home/work/code/synapse/.venv/lib/python3.14/site-packages/rpds/rpds.cpython-314-x86_64-linux-gnu.so", at +0x36881 [0x7f4655449881]
Binary file "/home/work/code/synapse/.venv/lib/python3.14/site-packages/rpds/rpds.cpython-314-x86_64-linux-gnu.so", at +0x126aa [0x7f46554256aa]
Binary file "/home/work/code/synapse/.venv/lib/python3.14/site-packages/rpds/rpds.cpython-314-x86_64-linux-gnu.so", at +0x12d55 [0x7f4655425d55]
Binary file "/home/work/code/synapse/.venv/lib/python3.14/site-packages/rpds/rpds.cpython-314-x86_64-linux-gnu.so", at +0x157bd [0x7f46554287bd]
Binary file "/home/work/code/synapse/.venv/lib/python3.14/site-packages/rpds/rpds.cpython-314-x86_64-linux-gnu.so", at +0x11d67 [0x7f4655424d67]
Binary file "/home/work/code/synapse/.venv/lib/python3.14/site-packages/rpds/rpds.cpython-314-x86_64-linux-gnu.so", at +0x13360 [0x7f4655426360]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at PyObject_Vectorcall+0x58 [0x7f4658d06bf8]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _PyEval_EvalFrameDefault+0x5923 [0x7f4658e8fae3]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x29c287 [0x7f4658e9c287]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x106806 [0x7f4658d06806]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x1da943 [0x7f4658dda943]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x1bfd07 [0x7f4658dbfd07]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _PyObject_MakeTpCall+0xf7 [0x7f4658d065c7]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _PyEval_EvalFrameDefault+0x5923 [0x7f4658e8fae3]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x43c135 [0x7f465903c135]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at PyEval_EvalCode+0xe8 [0x7f4658e86ab8]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x280abe [0x7f4658e80abe]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _PyEval_EvalFrameDefault+0x7472 [0x7f4658e91632]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x29c287 [0x7f4658e9c287]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x10896f [0x7f4658d0896f]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at PyObject_CallMethodObjArgs+0x10d [0x7f4658d095fd]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at PyImport_ImportModuleLevelObject+0x7f1 [0x7f4658eef961]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _PyEval_ImportName+0xf7 [0x7f4658e9d887]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _PyEval_EvalFrameDefault+0x44eb [0x7f4658e8e6ab]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x43c135 [0x7f465903c135]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at PyEval_EvalCode+0xe8 [0x7f4658e86ab8]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at +0x280abe [0x7f4658e80abe]
Binary file "/home/work/code/synapse/.devenv/profile/lib/libpython3.14.so.1.0", at _PyEval_EvalFrameDefault+0x7472 [0x7f4658e91632]
<truncated rest of calls>
Extension modules: zope.interface._zope_interface_coptimizations, _cffi_backend, PIL._imaging, markupsafe._speedups, yaml._yaml (total: 5)
[1] 473561 segmentation fault (core dumped) PYTHONFAULTHANDLER=1 trial
This was due to jsonschemas use of rpdss HashTrieMap type here:
jsonschema/jsonschema/_types.py
Lines 16 to 23 in d126eea
| # unfortunately, the type of HashTrieMap is generic, and if used as an attrs | |
| # converter, the generic type is presented to mypy, which then fails to match | |
| # the concrete type of a type checker mapping | |
| # this "do nothing" wrapper presents the correct information to mypy | |
| def _typed_map_converter( | |
| init_val: Mapping[str, Callable[[TypeChecker, Any], bool]], | |
| ) -> HashTrieMap[str, Callable[[TypeChecker, Any], bool]]: | |
| return HashTrieMap.convert(init_val) |
With Python 3.14, Python ABI changed such that HashTrieMap.convert() now segfaulted when attempting to hash keys.
To fix this, I updated rpds-py to 0.25.0, which depends on pyO3 0.25.0, which is the first to support Python 3.14. I suggest you do the same in your pyproject.toml:
Line 44 in d126eea
| "rpds-py>=0.7.1", |
Just be aware of the downstream distros you want to support, and their rpds-py package versions: https://repology.org/project/python%3Arpds-py/versions. Thanks!
Metadata
Metadata
Assignees
Labels
No labels