Page tree

Why does re-opening an HDF5 file that is already open with an external link fail, when the file was originally opened with H5F_CLOSE_STRONG?

The second open fails because there is a file close degree property list conflict. A file opened through an external link is always opened with H5F_CLOSE_WEAK, regardless of whether the file containing that link was originally opened with H5F_CLOSE_STRONG. Multiple files opened simultaneously in an application must be opened with the same property lists.

A file opened through an external link always uses the weak file close degree. This is necessary because there is no identifier for such a file and the file is being kept open by objects in it. If an external link were allowed to open an object with the strong file close degree, then all open objects in that file would be immediately closed when that object is closed. This behavior would be surprising or unexpected to some users.

For more information on the file close degree property list, see H5P_SET_FCLOSE_DEGREE.