h5py: infinite loop when closing file

I’m getting an “infinite loop closing library” error when using libver=“latest”.

See example below. Without the libver=‘latest’ the file closes fine, but the entire script takes some time to run (~8 seconds on my system). With the libver="latest’ it’s much faster (~0.2 seconds), but I get the infinite loop message.

This is with h5py 2.4 and hdf5 lib 1.8.14.

import h5py
import time

ATTR_COUNT = 1000
f = h5py.File("attr1k.h5", "w", libver='latest')

create_start = time.time()
print "creating attributes", create_start
# create attributes
for i in range(ATTR_COUNT):
    name = 'a{:04d}'.format(i)
    f.attrs[name] = "this is attribute: " + str(i)

modify_start = time.time()
print "updating attributes", modify_start

# modify
for i in range(ATTR_COUNT):
    name = 'a{:04d}'.format(i)
    f.attrs[name] = "an updated attribute: " + str(i)

modify_end = time.time();
print "done!", modify_end
print "total time: ", (modify_end - create_start)

f.close()

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

I am seeing the same bug appear randomly, have not found a pattern. This is the error I get:

CHDF5: infinite loop closing library D,G,S,T,F,FD,P,PL,FD,P,FD,P,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E

Has anyone looked into this?