Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InexactError: convert(UInt32, -1761558062) #619

Closed
tpapp opened this issue Nov 22, 2024 · 4 comments
Closed

InexactError: convert(UInt32, -1761558062) #619

tpapp opened this issue Nov 22, 2024 · 4 comments

Comments

@tpapp
Copy link

tpapp commented Nov 22, 2024

I am experiencing the error above using Julia v1.11, JLD2 v0.5.9. JLD2 0.5.5 works fine. If you prefer, I can try a bisection. Unfortunately the dataset is huge and I was not able to create an MWE, but it can be shared privately if you need it.

Here is the stacktrace:

julia> couples_posterior = load_posterior(; variant)
ERROR: InexactError: convert(UInt32, -1761558062)
Stacktrace:
  [1] throw_inexacterror(::Symbol, ::Vararg{Any})
    @ Core ./boot.jl:750
  [2] check_sign_bit
    @ ./boot.jl:756 [inlined]
  [3] toUInt32
    @ ./boot.jl:855 [inlined]
  [4] UInt32
    @ ./boot.jl:896 [inlined]
  [5] convert
    @ ./number.jl:7 [inlined]
  [6] rconvert
    @ ~/.julia/packages/JLD2/h8zCA/src/data/custom_serialization.jl:9 [inlined]
  [7] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
  [8] jlconvert
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
  [9] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
 [10] jlconvert
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
 [11] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/io/dataio.jl:125 [inlined]
 [12] macro expansion
    @ ./simdloop.jl:77 [inlined]
 [13] read_array!(v::Vector{…}, f::JLD2.JLDFile{…}, rr::JLD2.MappedRepr{…})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/io/dataio.jl:122
 [14] read_array(f::JLD2.JLDFile{…}, dataspace::JLD2.ReadDataspace, rr::JLD2.ReadRepresentation, layout::JLD2.DataLayout, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:239
 [15] read_data(f::JLD2.JLDFile{…}, rr::Any, read_dataspace::Tuple{…}, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:98
 [16] read_data(f::JLD2.JLDFile{…}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayout, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:84
 [17] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:48
 [18] jlconvert(::JLD2.MappedRepr{…}, f::JLD2.JLDFile{…}, ptr::Ptr{…}, ::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/data/writing_datatypes.jl:338
 [19] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:697 [inlined]
 [20] jlconvert(::JLD2.MappedRepr{…}, f::JLD2.JLDFile{…}, ptr::Ptr{…}, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650
 [21] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/io/dataio.jl:107
 [22] read_data(f::JLD2.JLDFile{…}, rr::Any, read_dataspace::Tuple{…}, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:96
 [23] read_data(f::JLD2.JLDFile{…}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayout, filters
::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{…})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:84
 [24] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:48
 [25] getindex(g::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, name::String)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/groups.jl:99
 [26] getindex
    @ ~/.julia/packages/JLD2/h8zCA/src/JLD2.jl:349 [inlined]
 [27] (::JLD2.var"#105#106"{String})(file::JLD2.JLDFile{JLD2.MmapIO})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:252
 [28] jldopen(::Function, ::String, ::Vararg{String}; kws::@Kwargs{})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:4
 [29] jldopen
    @ ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:1 [inlined]
 [30] load_object
    @ ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:248 [inlined]
@JonasIsensee
Copy link
Collaborator

Hi @tpapp ,

Do you think you could generate a stacktrace without the shortened type signatures?

That might already help me pin down the issue.

@tpapp
Copy link
Author

tpapp commented Nov 25, 2024

@JonasIsensee: sorry, should have done that in the first place.

julia> show(err)
1-element ExceptionStack:
InexactError: convert(UInt32, -1761558062)
Stacktrace:
  [1] throw_inexacterror(::Symbol, ::Vararg{Any})
    @ Core ./boot.jl:750
  [2] check_sign_bit
    @ ./boot.jl:756 [inlined]
  [3] toUInt32
    @ ./boot.jl:855 [inlined]
  [4] UInt32
    @ ./boot.jl:896 [inlined]
  [5] convert
    @ ./number.jl:7 [inlined]
  [6] rconvert
    @ ~/.julia/packages/JLD2/h8zCA/src/data/custom_serialization.jl:9 [inlined]
  [7] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
  [8] jlconvert
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
  [9] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
 [10] jlconvert
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650 [inlined]
 [11] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/io/dataio.jl:125 [inlined]
 [12] macro expansion
    @ ./simdloop.jl:77 [inlined]
 [13] read_array!(v::Vector{DynamicHMC.TreeStatisticsNUTS}, f::JLD2.JLDFile{JLD2.MmapIO}, rr::JLD2.MappedRepr{DynamicHMC.TreeStatisticsNUTS, JLD2.OnDiskRepresentation{(0, 8, 16, 32, 40, 48), Tuple{Float64, Int64, DynamicHMC.InvalidTree, Float64, Int64, DynamicHMC.Directions}, Tuple{Float64, Int64, DynamicHMC.InvalidTree, Float64, Int64, JLD2.OnDiskRepresentation{(0,), Tuple{Int32}, Tuple{Int32}, 4}}, 52}})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/io/dataio.jl:122
 [14] read_array(f::JLD2.JLDFile{JLD2.MmapIO}, dataspace::JLD2.ReadDataspace, rr::JLD2.ReadRepresentation, layout::JLD2.DataLayout, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{JLD2.ReadAttribute})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:239
 [15] 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/h8zCA/src/datasets.jl:98
 [16] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayout, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{JLD2.ReadAttribute})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:84
 [17] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:48
 [18] jlconvert(::JLD2.MappedRepr{Vector{DynamicHMC.TreeStatisticsNUTS}, JLD2.RelOffset}, f::JLD2.JLDFile{JLD2.MmapIO}, ptr::Ptr{Nothing}, ::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/data/writing_datatypes.jl:338
 [19] macro expansion
    @ ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:697 [inlined]
 [20] jlconvert(::JLD2.MappedRepr{@NamedTuple{posterior_matrix::Matrix{Float64}, tree_statistics::Vector{DynamicHMC.TreeStatisticsNUTS}, κ::DynamicHMC.GaussianKineticEnergy{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, LinearAlgebra.Diagonal{Float64, Vector{Float64}}}, ϵ::Float64}, JLD2.OnDiskRepresentation{(0, 8, 16, 32), Tuple{Matrix{Float64}, Vector{DynamicHMC.TreeStatisticsNUTS}, DynamicHMC.GaussianKineticEnergy{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, LinearAlgebra.Diagonal{Float64, Vector{Float64}}}, Float64}, Tuple{JLD2.RelOffset, JLD2.RelOffset, JLD2.OnDiskRepresentation{(0, 8), Tuple{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, LinearAlgebra.Diagonal{Float64, Vector{Float64}}}, Tuple{
JLD2.OnDiskRepresentation{(0,), Tuple{Vector{Float64}}, Tuple{JLD2.RelOffset}, 8}, JLD2.OnDiskRepresentation{(0,), Tuple
{Vector{Float64}}, Tuple{JLD2.RelOffset}, 8}}, 16}, Float64}, 40}}, f::JLD2.JLDFile{JLD2.MmapIO}, ptr::Ptr{Nothing}, hea
der_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/data/reconstructing_datatypes.jl:650
 [21] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, header_offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/io/dataio.jl:107
 [22] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, read_dataspace::Tuple{JLD2.ReadDataspace, JLD2.RelOffset, JLD2.Da
taLayout, JLD2.FilterPipeline}, attributes::Vector{JLD2.ReadAttribute})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:96
 [23] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, dataspace::JLD2.ReadDataspace, dt::JLD2.H5Datatype, layout::JLD2.DataLayou
t, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{JLD2.ReadAttribute})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:84
 [24] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/datasets.jl:48
 [25] getindex(g::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, name::String)
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/groups.jl:99
 [26] getindex
    @ ~/.julia/packages/JLD2/h8zCA/src/JLD2.jl:349 [inlined]
 [27] (::JLD2.var"#105#106"{String})(file::JLD2.JLDFile{JLD2.MmapIO})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:252
 [28] jldopen(::Function, ::String, ::Vararg{String}; kws::@Kwargs{})
    @ JLD2 ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:4
 [29] jldopen
    @ ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:1 [inlined]
 [30] load_object
    @ ~/.julia/packages/JLD2/h8zCA/src/loadsave.jl:248 [inlined]
 [31] #91
    @ ./none:0 [inlined]
 [32] iterate
    @ ./generator.jl:48 [inlined]
 [33] collect(itr::Base.Generator{UnitRange{Int64}, CouplesTimeuse.var"#91#93"{String}})
    @ Base ./array.jl:780
 [34] load_posterior(; variant::String, root_path::String, chains::UnitRange{Int64})
    @ CouplesTimeuse ~/research/spouses-time-allocation/CouplesTimeuse/src/couples_analysis.jl:21
 [35] top-level scope
    @ REPL[6]:1

@JonasIsensee
Copy link
Collaborator

Thanks!
I'm fairly certain that this is due to a typo I made while refactoring:

julia> jldsave("test.jld2"; u=typemax(UInt32))

julia> load("test.jld2")
Dict{String, Any} with 1 entry:
  "u" => -1

This is fixed in #622. Would you please check, if this fixes your issue?

@tpapp
Copy link
Author

tpapp commented Nov 25, 2024

Yes, I can confirm that it fixes the issue. Thanks for the quick fix!

If possible, please tag a patch release with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants