Skip to content

Wrap all access to h5 files in a lock#126

Merged
beitler merged 2 commits into
mainfrom
fix/h5read-concurrency
Jun 29, 2026
Merged

Wrap all access to h5 files in a lock#126
beitler merged 2 commits into
mainfrom
fix/h5read-concurrency

Conversation

@beitler

@beitler beitler commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Background

In #91 the hdf5 file access pattern was changed and the locking mechanism removed. This was done due to h5py's claim to be thread safe.

Problem Statement

Icon experienced sporadic SIGSEGV when a hdf5 file was read from multiple clients simultaneously. With GDB the SIGSEGV trigger could be localized to the hdf5 library

Thread 18 "python" received signal SIGSEGV, Segmentation fault.
0x00007ffff6f308c0 in H5F_addr_decode () from /tmp/h5/.venv/lib/python3.12/site-packages/h5py/../h5py.libs/libhdf5-9e18f0c6.so.320.0.0

More details: h5py/h5py#2920

Solution Proposal

For now, we wrap the h5_open context manager into a lock, such that hdf5 file access between threads in a process is serialized.

@beitler beitler requested a review from g-braeunlich June 26, 2026 14:58

@g-braeunlich g-braeunlich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@beitler beitler merged commit 649eb59 into main Jun 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants