JuliaIO / JLD2.jl

HDF5-compatible file format in pure Julia
Other
564 stars 92 forks source link

World age issue when dynamically loading CodecZlib #623

Open kbarros opened 1 week ago

kbarros commented 1 week ago

Hi, I'm on Julia 1.11 and JLD2 v0.5.10. Is the error below an expected behavior?

import JLD2
filename = "/Users/kbarros/Desktop/1Dcut_sym_0p00T_K.nxs"

# [ Info: Attempting to dynamically load CodecZlib
# ERROR: MethodError: no method matching CodecZlib.ZlibDecompressor()
# The applicable method may be too new: running in world age 26666, while current world is 26668.
data = JLD2.jldopen(filename, "r"; compress=false)
println(data["MDHistoWorkspace"]["data"]["signal"])

# The second time it works
data = JLD2.jldopen(filename, "r"; compress=false)
println(data["MDHistoWorkspace"]["data"]["signal"])

Also, is there any way to avoid the dependency on CodeZlib for this file?

1Dcut_sym_0p00T_K.nxs.zip

JonasIsensee commented 1 week ago

Hi @kbarros ,

I've also observed this on v1.11 and I don't know whether it can be fixed. This is one of the reasons that the dynamic loading will probably be removed from JLD2 in the future. (Instead, you should manually import CodecZlib)

About your second question: Loading your file triggered the loading of CodecZlib. This means that your dataset in this file is stored in compressed form. There is no way to access it without the (de-) compression algorithm.

Side note: the compress=false argument is the default and only used when writing anyway.

kbarros commented 1 week ago

Thanks, this sounds reasonable. I agree an error saying "You must load CodecZlib" would be preferable.