-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
LindiH5pyDataset maintains a dictionary that maps URLs to LindiRemfile objects that were used to open an external array dataset. These open files are not closed. For some reason, when a simple script has a function that has a return type that is a Tuple of lindi.LindiH5pyFile or lindi.LindiH5pyGroup or lindi.LindiH5pyDataset, when cleaning up Python execution of that function, we get a segmentation fault. This does not happen if the return type is simply lindi.LindiH5pyFile. This also does not happen if no data is sliced from the lindi.LindiH5pyDataset so no LindiRemfile object is opened.
I guess:
- Wrapping
lindi.LindiH5pyFileinTupledefers resolution oflindi.LindiH5pyFileto a later time lindi.LindiH5pyFileimportsLindiH5pyDataset- Importing
LindiH5pyDatasetinitializes a module-level variable_external_hdf5_clients - When cleaning up Python execution, the
LindiRemfilethat is stored inLindiH5pyDatasetgets closed and deleted from one importedLindiH5pyDatasetbut not the other? I'm not sure...
MWE:
from typing import Tuple
import lindi
def do_nothing() -> Tuple[lindi.LindiH5pyFile]:
pass
rfs = "https://dandi-api-staging-dandisets.s3.amazonaws.com/blobs/7f0/aa4/7f0aa474-4169-42f8-a895-ada0af4072c7"
client = lindi.LindiH5pyFile.from_lindi_file(url_or_path=rfs)
print(client["acquisition"]["ElectricalSeries"]["data"][0,0])
# the following code prevents the segmentation fault during Python execution clean up
# the external array link is where the external array for client["acquisition"]["ElectricalSeries"]["data"] is located
ext_array_link = "https://api.dandiarchive.org/api/assets/df0e074e-3509-4b03-908e-2a1303072707/download/"
client["acquisition"]["ElectricalSeries"]["data"]._get_external_hdf5_client(ext_array_link).close()Related to NeurodataWithoutBorders/nwb_benchmarks#136
Metadata
Metadata
Assignees
Labels
No labels