Skip to content
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

Crash with h5py3.0rc1 on macos #92

Closed
t20100 opened this issue Oct 16, 2020 · 12 comments
Closed

Crash with h5py3.0rc1 on macos #92

t20100 opened this issue Oct 16, 2020 · 12 comments
Labels

Comments

@t20100
Copy link
Member

t20100 commented Oct 16, 2020

Tested on macos with python3.7, h5py and hdf5plugin installed from wheels.

Some filters crash with h5py 3.0rc1:

import h5py, hdf5plugin, numpy 
f = h5py.File("test.h5", "a")

f.create_dataset('data2', data=numpy.arange(643*922*3, dtype='uint8'), **hdf5plugin.Blosc())                                                                            
Python(1757,0x7fffafcbe3c0) malloc: *** error for object 0x7f8404b04c30: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
...
f.create_dataset('data2', data=numpy.arange(643*922*3, dtype='uint8'), **hdf5plugin.Bitshuffle())                                                                       
Python(1742,0x7fffafcbe3c0) malloc: *** error for object 0x7fbff9424430: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
...
f.create_dataset('data2', data=numpy.arange(643*922*3, dtype='float32'), **hdf5plugin.Zfp())                                                                            
Python(1772,0x7fffafcbe3c0) malloc: *** error for object 0x7f8befc88e30: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

LZ4 and FciDecomp works for fine under same conditions.

I cannot reproduce the same with a python3.8 virtualenv on ubuntu20.04.

@t20100 t20100 added the bug label Oct 16, 2020
@vasole
Copy link
Member

vasole commented Oct 16, 2020

I suspect a bad build. This is what I find on actual MacOS El Capitan: Symbol not found: ____chkstk_darwin

Vs-MacBook-Pro:test sole$ ls
bitshuffle.h5	ficdecomp.h5	test.py		zfp_052.h5
blosc.h5	lz4.h5		zfp_050.h5	zfp_054.h5
Vs-MacBook-Pro:test sole$ python3 test.py 
Traceback (most recent call last):
  File "test.py", line 34, in <module>
    import h5py
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/h5py/__init__.py", line 25, in <module>
    from . import _errors
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/h5py/_errors.cpython-38-darwin.so, 2): Symbol not found: ____chkstk_darwin
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/h5py/.dylibs/libsz.2.dylib
  Expected in: /usr/lib/libSystem.B.dylib
 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/h5py/.dylibs/libsz.2.dylib

@t20100
Copy link
Member Author

t20100 commented Oct 16, 2020

Symbol not found: ____chkstk_darwin issue is solved in h5py: h5py/h5py#1707

@vasole
Copy link
Member

vasole commented Oct 16, 2020

Yes with your wheel I get the same error as you had. Trying to build everything on an old Mac.

@vasole
Copy link
Member

vasole commented Oct 16, 2020

Still crashing with the same error with HDF5 and h5py built on the same mac.

@t20100
Copy link
Member Author

t20100 commented Oct 19, 2020

Similar issue on h5py with lzf filter: h5py/h5py#1711
Behavior is the same here, commenting the free in the blosc filter avoids the crash.

@t20100
Copy link
Member Author

t20100 commented Oct 19, 2020

@t20100
Copy link
Member Author

t20100 commented Oct 19, 2020

It works when building current h5py master with libHDF5 1.10.6, so it seems to be due to some changes in HDF5 1.12.0 regarding memory management.

@t20100
Copy link
Member Author

t20100 commented Oct 20, 2020

Related PR on hdf5-blosc: Blosc/hdf5-blosc#21

@t20100
Copy link
Member Author

t20100 commented Oct 20, 2020

Using H5free_memory instead of free looks to fix the issue.

@vasole
Copy link
Member

vasole commented Oct 20, 2020

Does it need to replace all the malloc and free?

@t20100
Copy link
Member Author

t20100 commented Oct 20, 2020

@vasole
Copy link
Member

vasole commented Oct 20, 2020

I can confirm the problem disappears setting configure flags.

HDFGroup/hdf5#53

Not an hdf5plugin issue.

@vasole vasole closed this as completed Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants