ERROR: Failed to open HDF5 file with mode 'w': summary.h5

Hi all, i am having this error in my code. What might be the reason for that and how to solve it?

Reading c_H_in_H2O from /home/shuvo/Documents/LANL cross section
libraries/Version VIII.0/lib80x/lib80x_hdf5/c_H_in_H2O.h5
Minimum neutron data temperature: 600.000000 K
Maximum neutron data temperature: 600.000000 K
Reading tallies XML file…
Preparing distributed cell instances…
Writing summary.h5 file…
HDF5-DIAG: Error detected in HDF5 (1.10.6) thread 140278100912064:
#000: H5F.c line 444 in H5Fcreate(): unable to create file
major: File accessibilty
minor: Unable to open file
#001: H5Fint.c line 1567 in H5F_open(): unable to lock the file
major: File accessibilty
minor: Unable to open file
#002: H5FD.c line 1640 in H5FD_lock(): driver lock request failed
major: Virtual File Layer
minor: Can’t update object
#003: H5FDsec2.c line 959 in H5FD_sec2_lock(): unable to lock file, errno = 11, error message = ‘Resource temporarily unavailable’
major: File accessibilty
minor: Bad file ID accessed
ERROR: Failed to open HDF5 file with mode ‘w’: summary.h5


CalledProcessError Traceback (most recent call last)
in
----> 1 openmc.run()

~/miniconda3/lib/python3.8/site-packages/openmc/executor.py in run(particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based)
216 args = mpi_args + args
217
→ 218 _run(args, output, cwd)

~/miniconda3/lib/python3.8/site-packages/openmc/executor.py in _run(args, output, cwd)
26 # Raise an exception if return status is non-zero
27 if p.returncode != 0:
—> 28 raise subprocess.CalledProcessError(p.returncode, ’ '.join(args),
29 ‘’.join(lines))
30

CalledProcessError: Command ‘openmc’ returned non-zero exit status 255

Hi @TOWHID

I had faced this problem before, Not sure whether my solution is relating to yours or not. I solved
ERROR: Failed to open HDF5 file with mode ‘w’: summary.h5

by set the value of the environment variable HDF5_USE_FILE_LOCKING to FALSE via terminal.

/bin/nano ~/.bashrc
export HDF5_USE_FILE_LOCKING=FALSE

Hope this helps,
Sivakorn Sansawas

2 Likes

@Sivakorn.SSW thank you so much for your suggestion.
Apparently i solve this problem in other way.
In my case what i did, was closing the previously opened script and shutting down all kernels and then restarting them. That’s how i solve this problem.
But thanks for your solution too.

Hi @TOWHID,

I just wanted to note that the openmc.StatePoint object has a close method that will allow you to release the HDF5 filehandle of both the statepoint.*.h5 file and the summary.h5 file if it is linked.

For others running into this problem and coming across this thread, here’s a link to the troubleshooting section in the docs on this issue.

https://docs.openmc.org/en/stable/usersguide/troubleshoot.html#runtimeerror-failed-to-open-hdf5-file-with-mode-w-summary-h5

This section notes that a more elegant way to manage the statepoint file handle is to retrieve data from the file within a context manager:

with openmc.StatePoint('statepoint.10.h5') as sp:
    k_eff = sp.keff

when the interpreter exits this block, the object will be automatically cleaned up and the HDF5 file handle will be released.

Either approach works, just wanted to let you know about both!

-Patrick

5 Likes

@pshriwise thank you so much for your solution.

This has worked for me too. Thank you @TOWHID

1 Like

Hello there, I have the same issue and honestly I didn’t understand what should I do with this trouble shooting page. I am a bit rookie so can you give more detail regarding this solution?

Thank you

I tried to implement

with openmc.StatePoint('statepoint.10.h5') as sp:
    k_eff = sp.keff

this part at the end of my input file but it didn’t work.