# Failure to get a file lock reading HF5: Singularity Container: NFSv4: ANTS

**URL:** https://discourse.itk.org/t/failure-to-get-a-file-lock-reading-hf5-singularity-container-nfsv4-ants/4973
**Category:** Uncategorized
**Created:** [May 9, 2022, 10:11pm UTC](https://discourse.itk.org/t/failure-to-get-a-file-lock-reading-hf5-singularity-container-nfsv4-ants/4973 "2022-05-09T22:11:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![toomanycats](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@toomanycats](https://discourse.itk.org/u/toomanycats)
#### Post date: [May 9, 2022, 10:11pm UTC](https://discourse.itk.org/t/failure-to-get-a-file-lock-reading-hf5-singularity-container-nfsv4-ants/4973/1 "2022-05-09T22:11:15Z")

</div>

I’m running the NiPreps project, FmriPrep inside of a Singularity container. There’s a lot wrappers, including Nipype, but I do get an ITKv5 failure to read an HF5 transform because of a file lock issue.

I’m wondering if NFSv4 could be the culprit ? Does anyone have experience with this ?  
TIA

NOTE: I can step inside the container and run the ANTS apply transform. There is a temp file missing so I could not call the whole command string (`tmp-r5u5c1tz/mat2itk_pos-003_xfm-00001.txt`). However, I was able to leave out the missing file but still included the offending HF5 transform (`registration/ants_t1_to_mniComposite.h5`. There was no error.

```auto
RuntimeError: Command:
antsApplyTransforms --default-value 0 --float 1 --input /work/fmriprep_wf/single_subject_DPOP022_wf/func_preproc_ses_1_task_rest_run_7_wf/bold_split/vol0001.nii.gz --interpolation LanczosWindowedSinc --output /work/fmriprep_wf/single_subject_DPOP022_wf/func_preproc_ses_1_task_rest_run_7_wf/bold_std_trans_wf/_std_target_MNI152NLin2009cAsym.resnative/bold_to_std_transform/vol0001_xform-00001.nii.gz --reference-image /work/fmriprep_wf/single_subject_DPOP022_wf/func_preproc_ses_1_task_rest_run_7_wf/bold_std_trans_wf/_std_target_MNI152NLin2009cAsym.resnative/gen_ref/tpl-MNI152NLin2009cAsym_res-02_T1w_reference.nii.gz --transform /work/fmriprep_wf/single_subject_DPOP022_wf/anat_preproc_wf/anat_norm_wf/_template_MNI152NLin2009cAsym/registration/ants_t1_to_mniComposite.h5 --transform /work/fmriprep_wf/single_subject_DPOP022_wf/func_preproc_ses_1_task_rest_run_7_wf/bold_reg_wf/bbreg_wf/concat_xfm/out_fwd.tfm --transform identity --transform /work/fmriprep_wf/single_subject_DPOP022_wf/func_preproc_ses_1_task_rest_run_7_wf/bold_std_trans_wf/_std_target_MNI152NLin2009cAsym.resnative/bold_to_std_transform/tmp-r5u5c1tz/mat2itk_pos-003_xfm-00001.txt
Standard output:

Standard error:
HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 0:
  #000: /src/ants/build/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5F.c line 509 in itk_H5Fopen(): unable to open file
    major: File accessibilty
    minor: Unable to open file
  #001: /src/ants/build/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Fint.c line 1400 in itk_H5F__open(): unable to open file
    major: File accessibilty
    minor: Unable to open file
  #002: /src/ants/build/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Fint.c line 1615 in itk_H5F_open(): unable to lock the file
    major: File accessibilty
    minor: Unable to open file
  #003: /src/ants/build/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FD.c line 1640 in itk_H5FD_lock(): driver lock request failed
    major: Virtual File Layer
    minor: Can't update object
  #004: /src/ants/build/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FDsec2.c line 941 in H5FD_sec2_lock(): unable to lock file, errno = 5, error message = 'Input/output error'
    major: File accessibilty
    minor: Bad file ID accessed
Transform reader for /work/fmriprep_wf/single_subject_DPOP022_wf/anat_preproc_wf/anat_norm_wf/_template_MNI152NLin2009cAsym/registration/ants_t1_to_mniComposite.h5 caught an ITK exception:

itk::ExceptionObject (0x39845d0)
Location: "unknown" 
File: /src/ants/build/ITKv5/Modules/IO/TransformHDF5/src/itkHDF5TransformIO.cxx
Line: 363
Description: itk::ERROR: HDF5TransformIOTemplate(0x3979880): H5Fopen failed

Return code: 1

```

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [May 13, 2022, 10:00am UTC](https://discourse.itk.org/t/failure-to-get-a-file-lock-reading-hf5-singularity-container-nfsv4-ants/4973/2 "2022-05-13T10:00:32Z")

</div>

Hi Daniel,

Welcome to the ITK community! 🌞

The error looks like it may be related to access to the file?

For reference, @jtduda recently provided a tutorial on ANTs within singularity here:

[https://insightsoftwareconsortium.github.io/GetYourBrainStraight/HCK01\_2022\_Virtual/Tutorials/GetYourBrainPipelined/](https://insightsoftwareconsortium.github.io/GetYourBrainStraight/HCK01_2022_Virtual/Tutorials/GetYourBrainPipelined/)

[![](https://discourse.itk.org/uploads/default/original/2X/a/a79f9ed5a3a96362c5ad35a6e9f0dc7a409faa84.jpeg "Get Your Brain Straight Hackathon 01: Get Your Brain Pipelined") ](https://www.youtube.com/watch?v=KwgkHB7fipw)

---

<div class="post-metadata">

### Author: ![toomanycats](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@toomanycats](https://discourse.itk.org/u/toomanycats)
#### Post date: [May 13, 2022, 6:49pm UTC](https://discourse.itk.org/t/failure-to-get-a-file-lock-reading-hf5-singularity-container-nfsv4-ants/4973/3 "2022-05-13T18:49:29Z")

</div>

Thanks Matt.

What I though was strange, is that when I step inside the container, I can run the transform. However, it fails intermittently. I ran it several times from the command line and 1 of 10 I’d get an error.

I don’t expect you guys to solve a file system issue. I’m trying to find more information about such a problem. Hopefully the lecture will help.
