Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slicetools platform-specific error could not get virtual filename #356

Closed
peytondmurray opened this issue Jul 17, 2024 · 5 comments · Fixed by #376 or #383
Closed

Slicetools platform-specific error could not get virtual filename #356

peytondmurray opened this issue Jul 17, 2024 · 5 comments · Fixed by #376 or #383
Assignees

Comments

@peytondmurray
Copy link
Collaborator

peytondmurray commented Jul 17, 2024

Likely related to #352 - the following is broken on Linux (but not Mac) with the latest commit on master:

import h5py
from versioned_hdf5 import VersionedHDF5File
import numpy as np


d = './testdata.h5'

with h5py.File(d, mode="w") as f:
    vf = VersionedHDF5File(f)
    with vf.stage_version("r0") as sv:
        sv.create_dataset('values', data=np.arange(100), chunks=(10,), maxshape=(None,))

with h5py.File(d, mode="r+") as f:
    vf = VersionedHDF5File(f)
    with vf.stage_version("r1") as sv:
        values = sv['values']
        values.resize((110,))  # <-- Exception raised here

With h5py==3.11.0 I get the following:

HDF5-DIAG: Error detected in HDF5 (1.14.4-3) thread 0:
  #000: H5Pdcpl.c line 2406 in H5Pget_virtual_filename(): can't find object for ID
    major: Object ID
    minor: Unable to find ID information (already closed?)
  #001: H5Pint.c line 4102 in H5P_object_verify(): property list is not a member of the class
    major: Property lists
    minor: Can't compare objects
  #002: H5Pint.c line 4053 in H5P_isa_class(): not a property list
    major: Invalid arguments to routine
    minor: Inappropriate type
Traceback (most recent call last):
  File "/home/pdmurray/Desktop/workspace/sandbox/vhdf/run.py", line 20, in <module>
    values.resize((110,))  # <-- Exception raised here
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdmurray/Desktop/workspace/versioned-hdf5/versioned_hdf5/wrappers.py", line 777, in resize
    data_dict = self.id.data_dict
                ^^^^^^^^^^^^^^^^^
  File "/home/pdmurray/Desktop/workspace/versioned-hdf5/versioned_hdf5/wrappers.py", line 1451, in data_dict
    self._data_dict = build_data_dict(dcpl, self.raw_data.name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "slicetools.pyx", line 128, in versioned_hdf5.slicetools.build_data_dict
  File "slicetools.pyx", line 144, in versioned_hdf5.slicetools.build_data_dict
  File "slicetools.pyx", line 168, in versioned_hdf5.slicetools.build_data_dict
ValueError: Could not get virtual filename
@peytondmurray peytondmurray self-assigned this Jul 17, 2024
@peytondmurray
Copy link
Collaborator Author

peytondmurray commented Jul 22, 2024

As I mentioned above, I can reproduce with 3.11.0 but as of h5py commit 2c80981022e741a04e02d4afd6ae78bac1bc770f the error is gone and everything works as intended. I can't yet tell if this is again some kind of cython/typing issue, but one thing to note is that it is probably not necessary to call into the underlying hdf5 library to get the virtual filename - the dcpl object passed into the build_data_dict function where the issue is happening is a PropDCID type with a pure-Cython .get_virtual_filename function, with the only call into Python code being the allocation of a bytes object. So I doubt if we would lose much if we just call into that function instead.

@peytondmurray
Copy link
Collaborator Author

peytondmurray commented Oct 1, 2024

Returning to this as it is now interfering with asv benchmarks. I bisected from the current HEAD commit on master (c783fd18f7209a8e1e9f127534a25f8a7071d750) with 2c80981022e741a04e02d4afd6ae78bac1bc770f as the good commit and found c783fd18f7209a8e1e9f127534a25f8a7071d750 to be responsible, though I don't think that's even possible because it doesn't touch anything except documentation and a version string.

It looks like h5py is not listed as a build time dependency although I think it should be because slicetools.pyx imports from h5py. Maybe building against one version and running against another was the issue?

However adding h5py==3.12.1 as a build time and run time dependency didn't solve the problem, so for the time being I'm stumped.

@crusaderky
Copy link
Collaborator

I have not stumbled on this myself.
However, looking at the code it seems that the whole filename-related code is just an (expensive) health check and it could be easily excised away.

peytondmurray added a commit to peytondmurray/versioned-hdf5 that referenced this issue Oct 1, 2024
@peytondmurray
Copy link
Collaborator Author

Here's an example workflow run where this issue manifests: https://github.com/peytondmurray/versioned-hdf5/actions/runs/11133548339/job/30939875253.

@peytondmurray
Copy link
Collaborator Author

With #376, I now get

HDF5-DIAG: Error detected in HDF5 (1.14.4-3) thread 0:
  #000: H5Pdcpl.c line 2252 in H5Pget_virtual_vspace(): can't find object for ID
    major: Object ID
    minor: Unable to find ID information (already closed?)
  #001: H5Pint.c line 4102 in H5P_object_verify(): property list is not a member of the class
    major: Property lists
    minor: Can't compare objects
  #002: H5Pint.c line 4053 in H5P_isa_class(): not a property list
    major: Invalid arguments to routine
    minor: Inappropriate type
Traceback (most recent call last):
  File "/home/pdmurray/Desktop/workspace/sandbox/vhdf/run.py", line 20, in <module>
    values.resize((110,))  # <-- Exception raised here
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdmurray/Desktop/workspace/versioned-hdf5/versioned_hdf5/wrappers.py", line 736, in resize
    data_dict = self.id.data_dict
                ^^^^^^^^^^^^^^^^^
  File "/home/pdmurray/Desktop/workspace/versioned-hdf5/versioned_hdf5/wrappers.py", line 1416, in data_dict
    self._data_dict = build_data_dict(dcpl, self.raw_data.name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "slicetools.pyx", line 149, in versioned_hdf5.slicetools.build_data_dict
  File "slicetools.pyx", line 164, in versioned_hdf5.slicetools.build_data_dict
  File "slicetools.pyx", line 172, in versioned_hdf5.slicetools.build_data_dict
RuntimeError: HDF5-DIAG: Error detected in HDF5 (1.14.4-3) thread 0:
  #000: H5Pdcpl.c line 2252 in H5Pget_virtual_vspace(): can't find object for ID
    major: Object ID
    minor: Unable to find ID information (already closed?)
  #001: H5Pint.c line 4102 in H5P_object_verify(): property list is not a member of the class
    major: Property lists
    minor: Can't compare objects
  #002: H5Pint.c line 4053 in H5P_isa_class(): not a property list
    major: Invalid arguments to routine
    minor: Inappropriate type

Looks like dcpl_id doesn't correspond to a property list...

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