Skip to content

bsb-hdf5 unit tests randomly failing on GHA #178

@drodarie

Description

@drodarie

See for instance this action or that one:

It seems to happen for test_mr.TestHandcrafted.test_single_branch_single_element when running the tests in parallel
mpiexec -n 2 uv run coverage run -p -m unittest discover -v -s ./tests

This does not happen exclusively on Python 3.10 or 3.12, and the error is not always the same 😢:

   ======================================================================
  ERROR: test_single_branch_single_element (test_mr.TestHandcrafted.test_single_branch_single_element)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/tests/test_mr.py", line 106, in test_single_branch_single_element
      m = mr.load("M")
          ^^^^^^^^^^^^
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/bsb_hdf5/resource.py", line 47, in handle_indirection
      with lock(), engine._handle(handle_type) as handle:
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/bsb_hdf5/__init__.py", line 146, in _handle
      handle = h5py.File(self._root, mode)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/.venv/lib/python3.12/site-packages/h5py/_hl/files.py", line 564, in __init__
      fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/.venv/lib/python3.12/site-packages/h5py/_hl/files.py", line 238, in make_fid
      fid = h5f.open(name, flags, fapl=fapl)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "h5py/_objects.pyx", line 56, in h5py._objects.with_phil.wrapper
    File "h5py/_objects.pyx", line 57, in h5py._objects.with_phil.wrapper
    File "h5py/h5f.pyx", line 102, in h5py.h5f.open
  OSError: Unable to synchronously open file (can't retrieve stat info for file)

and


  ======================================================================
  ERROR: test_single_branch_single_element (test_mr.TestHandcrafted)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/tests/test_mr.py", line 106, in test_single_branch_single_element
      m = mr.load("M")
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/bsb_hdf5/resource.py", line 49, in handle_indirection
      return f(*bound.args, **bound.kwargs)
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/bsb_hdf5/morphology_repository.py", line 155, in load
      meta = self.get_meta(name, handle=handle)
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/bsb_hdf5/resource.py", line 47, in handle_indirection
      with lock(), engine._handle(handle_type) as handle:
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/bsb_hdf5/__init__.py", line 146, in _handle
      handle = h5py.File(self._root, mode)
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/.venv/lib/python3.10/site-packages/h5py/_hl/files.py", line 564, in __init__
      fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
    File "/home/runner/work/bsb/bsb/packages/bsb-hdf5/.venv/lib/python3.10/site-packages/h5py/_hl/files.py", line 238, in make_fid
      fid = h5f.open(name, flags, fapl=fapl)
    File "h5py/_objects.pyx", line 56, in h5py._objects.with_phil.wrapper
    File "h5py/_objects.pyx", line 57, in h5py._objects.with_phil.wrapper
    File "h5py/h5f.pyx", line 102, in h5py.h5f.open
  FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = 'test3.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bsb-hdf5Auto-created by migration script

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions