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
BUG: Segfault when trying to access a returned numpy array backed by a buffer of named shared memory #18294
Comments
If you use the memoryviews directly (replace Further, if you use
Which is in |
|
this is a duplicate of #9537 |
Yeah, although it highlights a slight variation in |
Marking as bug, because I think we should add the workaround (which will cause a Python error rather than a segfault). That won't actually help you @ikeboy but it would at least make it more clear that this pattern is invalid (and maybe why). We do have |
The core of this issue is identical to gh-23305 so closing. |
I'm not 100% sure if this is a numpy or python bug, but the behavior is quite weird. I've narrowed it down to two simple test cases, one which works and one which segfaults.
I can create a SharedMemory object, I can create a numpy array backed by it and read and write to it. I can do the same with a second SharedMemory object referring to the same space, created using the name. But I can't have a function return this np array, or accesses will segfault.
Reproducing code example:
Error message:
Thread 1 "python3-dbg" received signal SIGSEGV, Segmentation fault.
0x00007ffff692e0e9 in INT_setitem (op=0, ov=0x7ffff7491000, vap=0x7fffd68cbd60) at numpy/core/src/multiarray/arraytypes.c.src:235
235 numpy/core/src/multiarray/arraytypes.c.src: No such file or directory.
(gdb) py-bt
Traceback (most recent call first):
File "segfault_poc_simple.py", line 66, in
np_array[:] = (0, 0) # segfaults
NumPy/Python version information:
1.17.4 3.8.6 (default, Sep 25 2020, 09:36:53)
[GCC 10.2.0]
The text was updated successfully, but these errors were encountered: