Skip to content

fail to load (sometimes) #711

@koehlerson

Description

@koehlerson

I have a hard time describing the bug since it seems very strange to me.
In my JLD2 files, I usually bundle all the information of a boundary value problem in a "model" struct. Then, within "solutions," you find different solution information of the boundary value problem for individual time steps.

I noticed that multiple attempts are sometimes necessary to successfully load the model struct.

julia> model = file["model"]
ERROR: MethodError: Cannot `convert` an object of type Type{SerendipityQuadraticHexahedron} to an object of type Vector{SerendipityQuadraticHexahedron}
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, N, Array{T, N}}) where {S, T, N}
   @ StaticArrays ~/.julia/packages/StaticArrays/IZgIP/src/SizedArray.jl:88
  convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, M, TData} where {M, TData<:AbstractArray{T, M}}) where {T, S, N}
   @ StaticArrays ~/.julia/packages/StaticArrays/IZgIP/src/SizedArray.jl:82
  convert(::Type{T}, ::AbstractArray) where T<:Array
   @ Base array.jl:614
  ...

Stacktrace:
  [1] rconvert(T::Type, x::Type)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/custom_serialization.jl:11
  [2] macro expansion
    @ ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:671 [inlined]
  [3] jlconvert(::JLD2.MappedRepr{…}, f::JLD2.JLDFile{…}, ptr::Ptr{…}, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:663
  [4] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/io/dataio.jl:107
  [5] read_data(f::JLD2.JLDFile{…}, rr::Any, read_dataspace::Tuple{…}, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:96
  [6] read_data(f::JLD2.JLDFile{…}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayout, filters::JLD2.Filters.FilterPipeline{…}, header_offset::JLD2.RelOffset, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:84
  [7] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:48
  [8] jlconvert(::JLD2.MappedRepr{Grid{…}, JLD2.RelOffset}, f::JLD2.JLDFile{JLD2.MmapIO}, ptr::Ptr{Nothing}, ::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/writing_datatypes.jl:338
  [9] macro expansion
    @ ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:710 [inlined]
 [10] jlconvert(::JLD2.MappedRepr{…}, f::JLD2.JLDFile{…}, ptr::Ptr{…}, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:663
 [11] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/io/dataio.jl:107
 [12] read_data(f::JLD2.JLDFile{…}, rr::Any, read_dataspace::Tuple{…}, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:96
 [13] read_data(f::JLD2.JLDFile{…}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayout, filters::JLD2.Filters.FilterPipeline{…}, header_offset::JLD2.RelOffset, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:84
 [14] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:48
 [15] getindex(g::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, name::String)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/groups.jl:99
 [16] getindex(f::JLD2.JLDFile{JLD2.MmapIO}, name::String)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/JLD2.jl:369
 [17] top-level scope
    @ REPL[9]:1
Some type information was truncated. Use `show(err)` to see complete types.

julia> model = file["model"]
ERROR: MethodError: Cannot `convert` an object of type Type{SerendipityQuadraticHexahedron} to an object of type Vector{SerendipityQuadraticHexahedron}
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, N, Array{T, N}}) where {S, T, N}
   @ StaticArrays ~/.julia/packages/StaticArrays/IZgIP/src/SizedArray.jl:88
  convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, M, TData} where {M, TData<:AbstractArray{T, M}}) where {T, S, N}
   @ StaticArrays ~/.julia/packages/StaticArrays/IZgIP/src/SizedArray.jl:82
  convert(::Type{T}, ::AbstractArray) where T<:Array
   @ Base array.jl:614
  ...

Stacktrace:
  [1] rconvert(T::Type, x::Type)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/custom_serialization.jl:11
  [2] macro expansion
    @ ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:671 [inlined]
  [3] jlconvert(::JLD2.MappedRepr{…}, f::JLD2.JLDFile{…}, ptr::Ptr{…}, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:663
  [4] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/io/dataio.jl:107
  [5] read_data(f::JLD2.JLDFile{…}, rr::Any, read_dataspace::Tuple{…}, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:96
  [6] read_data(f::JLD2.JLDFile{…}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayout, filters::JLD2.Filters.FilterPipeline{…}, header_offset::JLD2.RelOffset, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:84
  [7] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:48
  [8] jlconvert(::JLD2.MappedRepr{Grid{…}, JLD2.RelOffset}, f::JLD2.JLDFile{JLD2.MmapIO}, ptr::Ptr{Nothing}, ::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/writing_datatypes.jl:338
  [9] macro expansion
    @ ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:710 [inlined]
 [10] jlconvert(::JLD2.MappedRepr{…}, f::JLD2.JLDFile{…}, ptr::Ptr{…}, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/data/reconstructing_datatypes.jl:663
 [11] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/io/dataio.jl:107
 [12] read_data(f::JLD2.JLDFile{…}, rr::Any, read_dataspace::Tuple{…}, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:96
 [13] read_data(f::JLD2.JLDFile{…}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayout, filters::JLD2.Filters.FilterPipeline{…}, header_offset::JLD2.RelOffset, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:84
 [14] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/datasets.jl:48
 [15] getindex(g::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, name::String)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/groups.jl:99
 [16] getindex(f::JLD2.JLDFile{JLD2.MmapIO}, name::String)
    @ JLD2 ~/.julia/packages/JLD2/hbsZG/src/JLD2.jl:369
 [17] top-level scope
    @ REPL[9]:1
Some type information was truncated. Use `show(err)` to see complete types.

julia> model = file["model"]
FE Model

julia>

I tried it while the simulation was running, and new fields were potentially added to "solutions/timestep/..."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions