JuliaIO / MAT.jl

Julia module for reading MATLAB files
MIT License
278 stars 71 forks source link

Nested dictionaries are limited in size #78

Open vtjeng opened 6 years ago

vtjeng commented 6 years ago

I'm using a .mat file as a catalog to point to saved logs, and have found that the nested dictionary is limited in size.

Here's a minimal working example demonstrating the bug.

using MAT

UUID = 1

catalog_full_path = "sandbox.MAT"

d = Dict()
d["UUID"] = UUID
d["path_to_solve"] = Dict()
for solveID in 1:4093
    d["path_to_solve"]["s$solveID"] = "fake_solve_log_$solveID.mat"
end
matwrite(catalog_full_path, d)

Sample Error Message

HDF5-DIAG: Error detected in HDF5 (1.8.16) thread 140602060291136:
  #000: ../../../src/H5A.c line 259 in H5Acreate2(): unable to create attribute
    major: Attribute
    minor: Unable to initialize object
  #001: ../../../src/H5Aint.c line 275 in H5A_create(): unable to create attribute in object header
    major: Attribute
    minor: Unable to insert object
  #002: ../../../src/H5Oattribute.c line 347 in H5O_attr_create(): unable to create new attribute in header
    major: Attribute
    minor: Unable to insert object
  #003: ../../../src/H5Omessage.c line 224 in H5O_msg_append_real(): unable to create new message
    major: Object header
    minor: No space available for allocation
  #004: ../../../src/H5Omessage.c line 1945 in H5O_msg_alloc(): unable to allocate space for message
    major: Object header
    minor: Unable to initialize object
  #005: ../../../src/H5Oalloc.c line 1142 in H5O_alloc(): object header message is too large
    major: Object header
    minor: Unable to initialize object
HDF5-DIAG: Error detected in HDF5 (1.8.16) thread 140602060291136:
  #000: ../../../src/H5A.c line 817 in H5Aget_name(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type

I'm not sure whether this is an issue with MAT.jl or with the .mat file format, and I know that storing my solves directly in d can solve my problem. (I could also save my catalog in a different file format that is appends more efficiently).

Changing 4093 to 4092 shows the point at which the number of entries to the inner dictionary exceeds its capacity, the code runs fine with only 4092 objects.