Skip to content

[Bug Report] Failed HDF5 dataset open retains an open file and prevents handler reuse #9244

Backlog

Description

@sylvesterkaczmarek

Describe the bug

HDF5DatasetFileHandler.open() stores an open file before looking up its data group. If that lookup fails, the file remains open and the handler rejects subsequent opens until explicitly closed.

Reproduction

import h5py
from isaaclab.utils.datasets import HDF5DatasetFileHandler

with h5py.File("invalid.hdf5", "w"):
    pass
handler = HDF5DatasetFileHandler()
try:
    handler.open("invalid.hdf5")
except KeyError:
    pass
with h5py.File("invalid.hdf5", "w"):
    pass

Actual: HDF5 rejects truncation because the file remains open. Expected: release the file on failure and allow the handler to open a valid dataset.

System Info

main at ebf162a, macOS ARM64, Python 3.12, CPU. No Isaac Sim required.

Additional context

Keep the file and group local until initialization succeeds, closing the file if initialization raises. The regression reproduces the retained open file and verifies subsequent reuse. All six HDF5 handler tests passed after the correction.

Checklist

  • Checked for similar issues and PRs.
  • Reproduced without Isaac Sim.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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