SWIFTSIM / swiftgalaxy

Load in particles of a simulated galaxy, rotate coordinates, easy spherical/cylindrical coordinates, access integrated properties, and more.
GNU General Public License v3.0
2 stars 1 forks source link

Segmentation fault with python3.6 with 3.0.0<=h5py<=3.1.0 #1

Closed kyleaoman closed 1 year ago

kyleaoman commented 2 years ago

Describe the bug There is an issue apparently introduced in h5py 3.0.0 that causes a memory allocation issue leading to a segmentation fault.

To Reproduce Steps to reproduce the behaviour:

  1. Working in the tests directory of swiftgalaxy (for access to toysnap.py).
  2. python -c "from toysnap import *;create_toysnap();create_toyvr();from swiftgalaxy import *;vr=Velociraptor('toyvr', halo_index=0);sg=SWIFTGalaxy('toysnap.hdf5', vr);sg.gas.hydrogen_ionization_fractions.neutral" (note using a SWIFTDataset directly but naively doesn't seem to reproduce the error, but presumably would if the same mask was provided before invoking the read).
  3. Segmentation fault (core dumped)

Expected behaviour Data is read cleanly and program exits.

System and python details (please complete):

Additional context Some crashes complained of "corrupted chunks", errors in free() or malloc(), GC issues, and more. Crash seemed to occur around return statement of read_ranges_from_file_unchunked in swiftsimio/accelerated.py, but seems to actually be triggered somewhere in a garbage collection call while interpreting code in h5py.

kyleaoman commented 2 years ago

@JBorrow this came up in my tests, but smells like an upstream issue (probably in h5py but possibly in swiftsimio), thought you'd want to be aware. Or if this looks familiar, please let me know!

kyleaoman commented 2 years ago

The real issue is upstream in h5py. Details noted in https://github.com/SWIFTSIM/swiftsimio/issues/127

kyleaoman commented 1 year ago

h5py releases >=3.1.0 for python3.6 won't happen, but swiftsimio and swiftgalaxy no longer support python3.6, on any more recent python the solution is simply to update h5py to a recent version.