invenia / JLSO.jl

Julia Serialized Object (JLSO) file format for storing checkpoint data.
MIT License
90 stars 5 forks source link

JLSO.load fails in v 1.7.1 #119

Closed vishalhedgevantage closed 2 years ago

vishalhedgevantage commented 2 years ago

I recently upgraded from Julia 1.6.0 to 1.7.1 I tried to load a jlso file which has been saved in v 1.6.0. I noticed that the following statement which works fine in v 1.6.0 fails in v 1.7.1.

JLSO.load(filepath) with the following error - type DataType has no field mutable

Stacktrace: [1] getproperty @ .\Base.jl:37 [inlined] [2] ismutable(T::Type) @ BSON C:\Users\visha.julia\packages\BSON\aEqHo\src\write.jl:46 [3] iscyclic(T::Type) @ BSON C:\Users\visha.julia\packages\BSON\aEqHo\src\extensions.jl:136 [4] (::BSON.var"#45#46")(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) @ BSON C:\Users\visha.julia\packages\BSON\aEqHo\src\extensions.jl:140 [5] raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) @ BSON C:\Users\visha.julia\packages\BSON\aEqHo\src\read.jl:92 [6] (::BSON.var"#18#21"{IdDict{Any, Any}, Module})(x::Dict{Symbol, Any}) @ BSON C:\Users\visha.julia\packages\BSON\aEqHo\src\read.jl:82 [7] applychildren!(f::BSON.var"#18#21"{IdDict{Any, Any}, Module}, x::Dict{Symbol, Any}) @ BSON C:\Users\visha.julia\packages\BSON\aEqHo\src\BSON.jl:21

rofinn commented 2 years ago

This looks like yet another issue with BSON.jl. That package coupled the BSON spec with Julia specific extensions which appear to be breaking again.

https://github.com/JuliaIO/BSON.jl/issues/58

I think the solution may be to switch over to LightBSON.jl, but that won't fix your specific issue here. To confirm you should get the same error if you run read(filepath, JLSOFile)?

NOTE: By default JLSO trades convenience (serializing arbitrary types) for consistency (maintaining a consistent serialization schema). It's best to think of .jlso files like python pickles with breadcrumbs. As a result, you should not expect JLSO files to be immediately loadable across Julia versions or breaking packages releases. That being said, metadata is available without deserializing individual objects and provides a mechanism to reconstruct the save environment and convert the results to a more durable long term format.

vishalhedgevantage commented 2 years ago

I installed the latest version of BSON separately and after that I am able to get the JLSO working fine. Earlier to that I was getting BSON issues in reading JLSO files.

rofinn commented 2 years ago

Okay, is it alright if we close this specific issue for now? If possible it'd help if we noted which versions of BSON failed and worked after switching to Julia 1.7. I'll make a separate issue for switching to LightBSON.jl more generally.

vishalhedgevantage commented 2 years ago

this issue should be closed. I have not tried with various versions of BSON but atleast version 0.3.5 of BSON works with JLSO and Julia v1.7