-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: memmap segfaults on on-disk collision on the free-threaded build #29126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
On my Mac dev machine I get |
It'd be nice to write a multithreaded test script that uses e.g. |
That sounds something wrong going on with how pytest-run-parallel calls teardown_method. At any rate, it's unrelated with the segfaults. |
Never realized that memmap were still unsafe here. There may be some subtly here that makes this tricky, but the core of the fix would be to replace:
with |
Uh oh!
There was an error while loading. Please reload this page.
Describe the issue:
memmap
segfaults on python 3.13t when two threads try to open the same file (that didn't previously exist) with mode='w+'.Expected behaviour
Ideally, all threads read and write on the same file.
This should be in theory possible with three syscalls:
open(fname, O_CREAT)
If the above was for some reason impossible (I particularly expect trouble on NFS and similar filesystems), the segfault should be replaced with a meaningful exception (that doesn't leak resources).
Reproduce the code example:
autouse=True
fixtures by default in test suite #29090):Error message:
All tests that use
tmp_path
segfault; e.g.numpy/numpy/_core/tests/test_memmap.py
Lines 62 to 67 in ff1d6cc
These tests are thread-unsafe due to Quansight-Labs/pytest-run-parallel#14, which causes all threads to call memmap on the same file name at once.
Python and NumPy Versions:
python 3.13t
numpy git tip 2025-06-04
Runtime Environment:
32-core x86_64 Linux host
/tmp
is a ext4 mountpoint.The text was updated successfully, but these errors were encountered: