Skip to content

instability in test_read_write_attributes[adios2-comm0] #31

@drew-parsons

Description

@drew-parsons

There is some kind of instability in test_attributes.py::test_read_write_attributes, at least on Debian systems running tests with MPI.
Test logs can be found at https://ci.debian.net/packages/i/io4dolfinx/
e.g. for amd64 https://ci.debian.net/packages/i/io4dolfinx/unstable/amd64/

debian version 1.1.2-6 ought to be passing, but test_read_write_attributes[adios2-comm0] is failing MPI tests during setting, with the error message
https://ci.debian.net/data/autopkgtest/unstable/amd64/i/io4dolfinx/69606892/log.gz

2260s =================================== FAILURES ===================================
2260s ___________________ test_read_write_attributes[adios2-comm0] ___________________
2260s 
2260s comm = <mpi4py.MPI.Intracomm object at 0x7f3336912af0>, backend = 'adios2'
2260s tmp_path = PosixPath('/tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13/test_read_write_attributes_adi0')
2260s 
2260s     @pytest.mark.parametrize("comm", [MPI.COMM_SELF, MPI.COMM_WORLD])
2260s     def test_read_write_attributes(comm, backend, tmp_path):
2260s         if backend == "adios2":
2260s             import adios2
2260s     
2260s             if _v(np.__version__) >= _v("2.0.0") and _v(adios2.__version__) < _v("2.10.2"):
2260s                 pytest.skip(reason="Cannot use numpy>=2.0.0 and adios2<2.10.2")
2260s     
2260s         attributes1 = {
2260s             "a": np.array([1, 2, 3], dtype=np.uint8),
2260s             "b": np.array([4, 5], dtype=np.uint8),
2260s         }
2260s         attributes2 = {
2260s             "c": np.array([6], dtype=np.uint8),
2260s             "d": np.array([7, 8, 9, 10], dtype=np.float64),
2260s         }
2260s         fname = comm.bcast(tmp_path, root=0)
2260s         fname = fname / "attributes"
2260s         suffix = ".bp" if backend == "adios2" else ".h5"
2260s         file = fname.with_suffix(suffix)
2260s         # print(comm.size)
2260s     
2260s         io4dolfinx.write_attributes(
2260s             comm=comm, filename=file, name="group1", attributes=attributes1, backend=backend
2260s         )
2260s         io4dolfinx.write_attributes(
2260s             comm=comm, filename=file, name="group2", attributes=attributes2, backend=backend
2260s         )
2260s >       loaded_attributes1 = io4dolfinx.read_attributes(
2260s             comm=comm, filename=file, name="group1", backend=backend
2260s         )
2260s 
2260s tests/test_attributes.py:38: 
2260s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2260s /usr/lib/python3/dist-packages/io4dolfinx/checkpointing.py:97: in read_attributes
2260s     return backend_cls.read_attributes(filename, comm, name, backend_args)
2260s            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2260s /usr/lib/python3/dist-packages/io4dolfinx/backends/adios2/backend.py:106: in read_attributes
2260s     with ADIOSFile(
2260s /usr/lib/python3.13/contextlib.py:141: in __enter__
2260s     return next(self.gen)
2260s            ^^^^^^^^^^^^^^
2260s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2260s 
2260s adios = <adios2.bindings.adios2_bindings_mpi.ADIOS object at 0x7f3319612db0>
2260s filename = PosixPath('/tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13/test_read_write_attributes_adi0/attributes.bp')
2260s engine = 'BP4', mode = <Mode.Read: 2>, io_name = 'AttributesReader', comm = None
2260s 
2260s     @contextmanager
2260s     def ADIOSFile(
2260s         adios: adios2.ADIOS,
2260s         filename: Path | str,
2260s         engine: str,
2260s         mode: adios2.Mode,
2260s         io_name: str,
2260s         comm: MPI.Intracomm | None = None,
2260s     ):
2260s         io = adios.DeclareIO(io_name)
2260s         io.SetEngine(engine)
2260s         # ADIOS2 sometimes struggles with existing files/folders it should overwrite
2260s         if mode == adios2.Mode.Write:
2260s             filename = Path(filename)
2260s             if filename.exists() and comm is not None and comm.rank == 0:
2260s                 if filename.is_dir():
2260s                     shutil.rmtree(filename)
2260s                 else:
2260s                     filename.unlink()
2260s             if comm is not None:
2260s                 comm.Barrier()
2260s     
2260s >       file = io.Open(str(filename), mode)
2260s                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2260s E       RuntimeError: �[1;36m[Wed Mar 18 20:21:54 2026]�[1;34m [ADIOS2 EXCEPTION]�[0m <Engine> <BP4Reader> <OpenFiles> : File /tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13/test_read_write_attributes_adi0/attributes.bp could not be found within the 0.000000s timeout: errno=2: �[1;36m[Wed Mar 18 20:21:54 2026]�[1;34m [ADIOS2 EXCEPTION]�[0m <Toolkit> <transport::file::FilePOSIX> <CheckFile> : couldn't open file /tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13/test_read_write_attributes_adi0/attributes.bp/md.idx, in call to POSIX open: errno = 2: No such file or directory�[0m
2260s E       : iostream error�[0m
2260s E       : iostream error
2260s 
2260s /usr/lib/python3/dist-packages/io4dolfinx/backends/adios2/helpers.py:78: RuntimeError
2260s =========================== short test summary info ============================
2260s FAILED tests/test_attributes.py::test_read_write_attributes[adios2-comm0] - RuntimeError: �[1;36m[Wed Mar 18 20:21:54 2026]�[1;34m [ADIOS2 EXCEPTION]�[0m <Engine> <BP4Reader> <OpenFiles> : File /tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13/test_read_write_attributes_adi0/attributes.bp could not be found within the 0.000000s timeout: errno=2: �[1;36m[Wed Mar 18 20:21:54 2026]�[1;34m [ADIOS2 EXCEPTION]�[0m <Toolkit> <transport::file::FilePOSIX> <CheckFile> : couldn't open file /tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13/test_read_write_attributes_adi0/attributes.bp/md.idx, in call to POSIX open: errno = 2: No such file or directory�[0m
2260s ==== 1 failed, 1985 passed, 372 skipped, 1 deselected in 779.15s (0:12:59) =====
2260s 
2260s 
2260s ==================================== ERRORS ====================================
2260s __________ ERROR at setup of test_read_write_attributes[adios2-comm0] __________
2260s 
2260s self = PosixPath('/tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13')
2260s mode = 448, parents = False, exist_ok = False
2260s 
2260s     def mkdir(self, mode=0o777, parents=False, exist_ok=False):
2260s         """
2260s         Create a new directory at this given path.
2260s         """
2260s         try:
2260s >           os.mkdir(self, mode)
2260s E           FileExistsError: [Errno 17] File exists: '/tmp/autopkgtest-lxc.blx2i9jg/downtmp/autopkgtest_tmp/io4dolfinx_mpi_py3.13'
2260s 
2260s /usr/lib/python3.13/pathlib/_local.py:724: FileExistsError

The attributes error is not fully reproducible. Sometimes it does not fail.

But it has been seen across many architectures, amd64, arm64, riscv64, s390x (with h5py, not adios2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions