JuliaIO/JLD2.jl

World age issue when dynamically loading CodecZlib

Opened this issue · 2 comments

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

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.

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