JuliaIO / JLD2.jl

HDF5-compatible file format in pure Julia
Other
547 stars 85 forks source link

0.4.26 broken - UndefVarError in `JLD2.ReadRepresentation()` #434

Closed BioTurboNick closed 1 year ago

BioTurboNick commented 1 year ago

0.4.25 works fine here

UndefVarError: T not defined

Stacktrace:

[1] JLD2.ReadRepresentation{AbstractArray{T, 1}, JLD2.RelOffset}()
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/JLD2.jl:137

[2] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, rr::JLD2.ReadRepresentation{Any, JLD2.RelOffset}, read_dataspace::Tuple{JLD2.ReadDataspace, JLD2.RelOffset, JLD2.DataLayout, JLD2.FilterPipeline}, attributes::Vector{JLD2.ReadAttribute})
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/datasets.jl:272

[3] macro expansion
@ ~/.julia/packages/JLD2/NJRYf/src/datasets.jl:224 [inlined]

[4] macro expansion
@ ~/.julia/packages/JLD2/NJRYf/src/datatypes.jl:105 [inlined]

[5] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, dataspace::JLD2.ReadDataspace, datatype_class::UInt8, datatype_offset::Int64, layout::JLD2.DataLayout, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{JLD2.ReadAttribute})
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/datasets.jl:211

[6] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/datasets.jl:125

[7] jlconvert
@ ~/.julia/packages/JLD2/NJRYf/src/data/writing_datatypes.jl:314 [inlined]

[8] macro expansion
@ ~/.julia/packages/JLD2/NJRYf/src/data/reconstructing_datatypes.jl:606 [inlined]

[9] jlconvert(#unused#::JLD2.ReadRepresentation{DataFrames.DataFrame, JLD2.OnDiskRepresentation{(0, 8), Tuple{Any, DataFrames.Index}, Tuple{JLD2.RelOffset, JLD2.OnDiskRepresentation{(0, 8), Tuple{Dict{Symbol, Int64}, Any}, Tuple{JLD2.CustomSerialization{Array, JLD2.RelOffset}, JLD2.RelOffset}, 16}()}, 24}()}, f::JLD2.JLDFile{JLD2.MmapIO}, ptr::Ptr{Nothing}, header_offset::JLD2.RelOffset)
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/data/reconstructing_datatypes.jl:525

[10] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::JLD2.ReadRepresentation{DataFrames.DataFrame, JLD2.OnDiskRepresentation{(0, 8), Tuple{Any, DataFrames.Index}, Tuple{JLD2.RelOffset, JLD2.OnDiskRepresentation{(0, 8), Tuple{Dict{Symbol, Int64}, Any}, Tuple{JLD2.CustomSerialization{Array, JLD2.RelOffset}, JLD2.RelOffset}, 16}()}, 24}()}, header_offset::JLD2.RelOffset)
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/dataio.jl:37

[11] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, read_dataspace::Tuple{JLD2.ReadDataspace, JLD2.RelOffset, JLD2.DataLayout, JLD2.FilterPipeline}, attributes::Vector{JLD2.ReadAttribute})
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/datasets.jl:238

[12] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, dataspace::JLD2.ReadDataspace, datatype_class::UInt8, datatype_offset::Int64, layout::JLD2.DataLayout, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{JLD2.ReadAttribute})
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/datasets.jl:194

[13] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/datasets.jl:125

[14] getindex(g::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, name::String)
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/groups.jl:109

[15] getindex
@ ~/.julia/packages/JLD2/NJRYf/src/JLD2.jl:451 [inlined]

[16] loadtodict!(d::Dict{String, Any}, g::JLD2.JLDFile{JLD2.MmapIO}, prefix::String)
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/loadsave.jl:154

[17] loadtodict!
@ ~/.julia/packages/JLD2/NJRYf/src/loadsave.jl:153 [inlined]

[18] (::JLD2.var"#98#99")(file::JLD2.JLDFile{JLD2.MmapIO})
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/fileio.jl:39

[19] jldopen(::Function, ::String, ::Vararg{String}; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/loadsave.jl:4

[20] jldopen
@ ~/.julia/packages/JLD2/NJRYf/src/loadsave.jl:1 [inlined]

[21] #fileio_load#97
@ ~/.julia/packages/JLD2/NJRYf/src/fileio.jl:38 [inlined]

[22] fileio_load(f::FileIO.File{FileIO.DataFormat{:JLD2}, String})
@ JLD2 ~/.julia/packages/JLD2/NJRYf/src/fileio.jl:37

[23] #invokelatest#2
@ ./essentials.jl:729 [inlined]

[24] invokelatest
@ ./essentials.jl:726 [inlined]

[25] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:219

[26] action
@ ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:196 [inlined]

[27] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:185

[28] action
@ ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:185 [inlined]

[29] load(::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:113

[30] load
@ ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:109 [inlined]
JonasIsensee commented 1 year ago

Hi @BioTurboNick ,

I'm sorry. I must have broken this while fixing other bugs in v0.4.26 .

Can you please provide sufficient info for me to reproduce the issue?

BioTurboNick commented 1 year ago

I'm not sure if I can produce a minimal example (I'll try), but I'm pretty sure the proximate issue is from read_attr_data returning AbstractArray{T, 1} where T, which apparently can't be used as a type parameter.

JonasIsensee commented 1 year ago

ok, however minimal or not, the problem was not caught by the CI tests, so I'm not certain where to start.

edit: if you can share a file that throws the error on load, that would probably already help quite a bit.

BioTurboNick commented 1 year ago

Hmm... I can only reproduce it ~50% of the time. And often once a file seems to be working, it keeps working in that session. I can't find a file that consistently produces the error.

BioTurboNick commented 1 year ago

Alright well... this 56 MB file should trigger it sometimes. I'll remove the link once you confirm you've downloaded it.

It is JLD2 format despite the extension.

link removed

JonasIsensee commented 1 year ago

Thanks. I think #435 should fix the issue.

BioTurboNick commented 1 year ago

Ah, thanks!

BioTurboNick commented 1 year ago

I dropped that function in my notebook and it fixed it, so I'll consider this closed.

oameye commented 1 year ago

I had this issue too and usinge the open pull request #435 fixes it.