Slicer crashes when creating h5 file

Problem report for Slicer 4.13.0-2021-09-13 linux-amd64:

When I’m trying to create h5 file in scripted module using h5py package, Slicer 4.13 crashes without any error (even in attached debugger). File appears in filesystem without content (0 bytes).
Does not occur on Slicer 4.11.

Can you provide a short script that reproduces the issue?

What Linux are you using?

My OS: Ubuntu 20.04.3 LTS (Focal Fossa)
Kernel version: 5.9.0-050900-generic

Just type in console:

import h5py
f = h5py.File('new_file.h5', 'w')

I was able to reproduce the issue.

It seems that HDF5 that is shipped with ITK-5.2 conflicts with HDF in h5py.

gdb traceback result

Program terminated with signal SIGSEGV, Segmentation fault.

#0 0x00007f6c491e0e54 in itk_H5F_get_intent () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Slicer-4.13/libitkhdf5-shared-5.2.so.1

[Current thread is 1 (Thread 0x7f6c47622540 (LWP 586093))]

(gdb) backtrace

#0 0x00007f6c491e0e54 in itk_H5F_get_intent () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Slicer-4.13/libitkhdf5-shared-5.2.so.1

#1 0x00007f6c4929241e in H5O__create_ohdr () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Slicer-4.13/libitkhdf5-shared-5.2.so.1

#2 0x00007f6bfc4ac53c in H5O_create () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#3 0x00007f6bfc43caeb in H5G__obj_create_real () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#4 0x00007f6bfc43cce1 in H5G__obj_create () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#5 0x00007f6bfc43f6c9 in H5G_mkroot () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#6 0x00007f6bfc3f8e5e in H5F_open () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#7 0x00007f6bfc6006a5 in H5VL__native_file_create () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#8 0x00007f6bfc5ed287 in H5VL_file_create () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#9 0x00007f6bfc3ea9ab in H5Fcreate () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/lib/Python/lib/python3.6/site-packages/h5py/…/h5py.libs/libhdf5-00e8fae8.so.200.0.0

#10 0x00007f6bfaf3219b in __pyx_f_4h5py_4defs_H5Fcreate () at /tmp/pip-req-build-sxro7y2n/h5py/defs.c:11009

#11 0x00007f6b8f790fc9 in __pyx_pf_4h5py_3h5f_2create () at /tmp/pip-req-build-sxro7y2n/h5py/h5f.c:2787

#12 __pyx_pw_4h5py_3h5f_3create () at /tmp/pip-req-build-sxro7y2n/h5py/h5f.c:2749

#13 0x00007f6c56c1ed49 in PyCFunction_Call () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#14 0x00007f6bfacf5a0c in __Pyx_PyObject_Call () at /tmp/pip-req-build-sxro7y2n/h5py/_objects.c:12946

#15 0x00007f6bfad00162 in __pyx_pf_4h5py_8_objects_9with_phil_wrapper () at /tmp/pip-req-build-sxro7y2n/h5py/_objects.c:4118

#16 __pyx_pw_4h5py_8_objects_9with_phil_1wrapper () at /tmp/pip-req-build-sxro7y2n/h5py/_objects.c:4039

#17 0x00007f6c56bd18ca in _PyObject_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#18 0x00007f6c56bd1d30 in _PyObject_FastCallKeywords () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#19 0x00007f6c56ca5f2b in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#20 0x00007f6c56caad28 in _PyEval_EvalFrameDefault () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#21 0x00007f6c56ca5ddd in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#22 0x00007f6c56ca6076 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#23 0x00007f6c56caad28 in _PyEval_EvalFrameDefault () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#24 0x00007f6c56ca5ddd in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#25 0x00007f6c56cae675 in _PyFunction_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#26 0x00007f6c56bd19a6 in _PyObject_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#27 0x00007f6c56bd1a9d in _PyObject_Call_Prepend () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#28 0x00007f6c56bd176a in PyObject_Call () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#29 0x00007f6c56c3aef9 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#30 0x00007f6c56c35fe3 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#31 0x00007f6c56bd18ca in _PyObject_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#32 0x00007f6c56ca5f2b in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#33 0x00007f6c56ca9c8d in _PyEval_EvalFrameDefault () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#34 0x00007f6c56ca5ddd in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#35 0x00007f6c56ca639e in PyEval_EvalCodeEx () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#36 0x00007f6c56ca63cb in PyEval_EvalCode () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#37 0x00007f6c56ca355d in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#38 0x00007f6c56c1eba9 in _PyCFunction_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#39 0x00007f6c56ca615f in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#40 0x00007f6c56ca9c8d in _PyEval_EvalFrameDefault () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#41 0x00007f6c56ca5423 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#42 0x00007f6c56ca6341 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#43 0x00007f6c56ca9c8d in _PyEval_EvalFrameDefault () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#44 0x00007f6c56ca5ddd in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#45 0x00007f6c56ca6076 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#46 0x00007f6c56ca9c8d in _PyEval_EvalFrameDefault () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#47 0x00007f6c56ca5423 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#48 0x00007f6c56cae7e7 in _PyFunction_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#49 0x00007f6c56bd19a6 in _PyObject_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#50 0x00007f6c56bd1a9d in _PyObject_Call_Prepend () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#51 0x00007f6c56bd18ca in _PyObject_FastCallDict () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#52 0x00007f6c56bd2234 in PyObject_CallMethod () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Python/lib/libpython3.6m.so

#53 0x00007f6c7e1433a2 in ?? () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Slicer-4.13/libCTKScriptingPythonWidgets.so.0.1

#54 0x00007f6c7e143a81 in ctkPythonConsole::executeCommand(QString const&) () from /home/perklab/Slicer/Slicer-4.13.0-2021-09-10-linux-amd64/bin/…/lib/Slicer-4.13/libCTKScriptingPythonWidgets.so.0.1

I’ve tried a quick ugly workaround of copying libitkhdf* libraries (renaming them with -shared-5.2 suffix) from Slicer-4.11.20210226:

  • libitkhdf5_cpp-shared-5.2.so
  • libitkhdf5_cpp-shared-5.2.so.1
  • libitkhdf5-shared-5.2.so
  • libitkhdf5-shared-5.2.so.1

After this, Slicer did not crash when opened the h5 file, but I did not go any further with the testing.

You may ask ITK developers about this, but HDF5 very often has such problems.

Maybe you can use the more modern and Pythonic Zarr container instead.

2 Likes

Thanks for suggestion, I switched to zarr ;).

1 Like