pycapnp
pycapnp copied to clipboard
`from_bytes` does not properly release memory buffers under mmap
OS: macOS-12.1-arm64-arm-64bit Python: 3.9.7
Running the demo.py
from the following minimal example
will reliably produce the following exception 100% of the time:
Traceback (most recent call last):
File "/Users/ch/Desktop/pycapnp-mmap-issue/demo.py", line 18, in <module>
mv.release()
BufferError: memoryview has 1 exported buffer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ch/Desktop/pycapnp-mmap-issue/demo.py", line 18, in <module>
mv.release()
BufferError: cannot close exported pointers exist
I strongly suspect this will happen on other platforms as well. Note that the same issue
appears when not creating an explicit memoryview
(see read2()
in attached code).