Skip to content

Segfault in test_rejects_different_header_magic #863

@stefanor

Description

@stefanor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

From https://bugs.debian.org/1122076:

tests/unit/test_reader.py::test_rejects_different_header_magic is (intermittently) segfaulting under Python 3.14.

On 64c0e81:

$ PYTHONPATH=$(pwd)/src ve314/bin/python -m pytest tests/unit/test_reader.py -k test_rejects_different_header_magic
========================================= test session starts ==========================================
platform linux -- Python 3.14.2, pytest-8.4.2, pluggy-1.6.0
rootdir: /tmp/memray
configfile: pyproject.toml
plugins: syrupy-4.8.0, cov-7.0.0, textual-snapshot-1.1.0
collected 5 items / 4 deselected / 1 selected                                                          

tests/unit/test_reader.py .                                                                      [100%]

=================================== 1 passed, 4 deselected in 0.04s ====================================
$ PYTHONPATH=$(pwd)/src ve314/bin/python -m pytest tests/unit/test_reader.py -k test_rejects_different_header_magic
========================================= test session starts ==========================================
platform linux -- Python 3.14.2, pytest-8.4.2, pluggy-1.6.0
rootdir: /tmp/memray
configfile: pyproject.toml
plugins: syrupy-4.8.0, cov-7.0.0, textual-snapshot-1.1.0
collected 5 items / 4 deselected / 1 selected                                                          

tests/unit/test_reader.py Fatal Python error: Segmentation fault

Current thread 0x00007f63fc52b200 [python] (most recent call first):
  File "/tmp/memray/tests/unit/test_reader.py", line 30 in test_rejects_different_header_magic
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/python.py", line 157 in pytest_pyfunc_call
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/python.py", line 1671 in runtest
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/runner.py", line 178 in pytest_runtest_call
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/runner.py", line 246 in <lambda>
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/runner.py", line 344 in from_call
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/runner.py", line 245 in call_and_report
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/runner.py", line 136 in runtestprotocol
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/runner.py", line 117 in pytest_runtest_protocol
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/main.py", line 367 in pytest_runtestloop
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/main.py", line 343 in _main
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/main.py", line 289 in wrap_session
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/main.py", line 336 in pytest_cmdline_main
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/config/__init__.py", line 175 in main
  File "/tmp/memray/ve314/lib/python3.14/site-packages/_pytest/config/__init__.py", line 201 in console_main
  File "/tmp/memray/ve314/lib/python3.14/site-packages/pytest/__main__.py", line 9 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main

Current thread's C stack trace (most recent call first):
  Binary file "ve314/bin/python", at _Py_DumpStack+0x4a [0x472522]
  Binary file "ve314/bin/python" [0x4fc6c7]
  Binary file "/usr/lib/x86_64-linux-gnu/libc.so.6", at +0x40a50 [0x7f63fc240a50]
  Binary file "/usr/lib/x86_64-linux-gnu/libgcc_s.so.1", at +0x25ef0 [0x7f63fb413ef0]
  Binary file "/usr/lib/x86_64-linux-gnu/libgcc_s.so.1", at __gcc_personality_v0+0xd9 [0x7f63fb4140c9]
  Binary file "/usr/lib/x86_64-linux-gnu/libunwind.so.8", at __libunwind_Unwind_RaiseException+0x1c0 [0x7f63fb3aa740]
  Binary file "/usr/lib/x86_64-linux-gnu/libstdc++.so.6", at __cxa_throw+0x3b [0x7f63f94b93eb]
  Binary file "/tmp/memray/src/memray/_memray.cpython-314-x86_64-linux-gnu.so", at +0x2bdeb [0x7f63f97b4deb]
  Binary file "/tmp/memray/src/memray/_memray.cpython-314-x86_64-linux-gnu.so", at +0x4cb38 [0x7f63f97d5b38]
  Binary file "/tmp/memray/src/memray/_memray.cpython-314-x86_64-linux-gnu.so", at +0x77524 [0x7f63f9800524]
  Binary file "ve314/bin/python", at _PyObject_MakeTpCall+0x241 [0x526f51]
  Binary file "ve314/bin/python", at _PyEval_EvalFrameDefault+0x3607 [0x548757]
  Binary file "ve314/bin/python" [0x583944]
  Binary file "ve314/bin/python" [0x52e8be]
  Binary file "ve314/bin/python" [0x626aff]
  Binary file "ve314/bin/python", at _PyObject_MakeTpCall+0x36c [0x52707c]
  Binary file "ve314/bin/python", at _PyEval_EvalFrameDefault+0x10a51 [0x555ba1]
  Binary file "ve314/bin/python" [0x583944]
  Binary file "ve314/bin/python" [0x52e8be]
  Binary file "ve314/bin/python" [0x626aff]
  Binary file "ve314/bin/python" [0x68a579]
  Binary file "ve314/bin/python", at _PyEval_EvalFrameDefault+0x4a2c [0x549b7c]
  Binary file "ve314/bin/python" [0x583944]
  Binary file "ve314/bin/python" [0x52e8be]
  Binary file "ve314/bin/python" [0x626aff]
  Binary file "ve314/bin/python", at _PyObject_MakeTpCall+0x36c [0x52707c]
  Binary file "ve314/bin/python", at _PyEval_EvalFrameDefault+0x10a51 [0x555ba1]
  Binary file "ve314/bin/python" [0x583944]
  Binary file "ve314/bin/python" [0x52e8be]
  Binary file "ve314/bin/python" [0x626aff]
  Binary file "ve314/bin/python", at _PyObject_MakeTpCall+0x36c [0x52707c]
  Binary file "ve314/bin/python", at _PyEval_EvalFrameDefault+0x10a51 [0x555ba1]
  <truncated rest of calls>

Extension modules: markupsafe._speedups, memray._memray, memray._test_utils (total: 3)
Segmentation fault         PYTHONPATH=$(pwd)/src ve314/bin/python -m pytest tests/unit/test_reader.py -k test_rejects_different_header_magic

Expected Behavior

No segfaults is nice.

Steps To Reproduce

  1. On debian unstable
  2. apt install git python3.14-dev python3.14-venv
  3. git clone memray
  4. python3.14 -m venv ve314`
  5. ve314/bin/python -m pip install -r requirements-test.txt
  6. make build-ext PYTHON=ve314/bin/python
  7. PYTHONPATH=$(pwd)/src ve314/bin/python -m pytest tests/unit/test_reader.py -k test_rejects_different_header_magic

Memray Version

git HEAD

Python Version

3.14

Operating System

Linux

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions