JuliaIO / JLD.jl

Saving and loading julia variables while preserving native types
MIT License
278 stars 55 forks source link

TypeError: getfield: expected Symbol, got Int64 #62

Open Keno opened 8 years ago

Keno commented 8 years ago
julia> @save "tachyon1.jlprof" li lidict
WARNING: Method definition h5convert!(Ptr, JLD.JldFile, Bool, JLD.JldWriteSession) in module JLD at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590 overwritten at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590.
WARNING: Method definition h5convert!(Ptr, JLD.JldFile, Bool, JLD.JldWriteSession) in module JLD at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590 overwritten at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590.
WARNING: Method definition h5convert!(Ptr, JLD.JldFile, Bool, JLD.JldWriteSession) in module JLD at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590 overwritten at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590.
WARNING: Method definition h5convert!(Ptr, JLD.JldFile, Bool, JLD.JldWriteSession) in module JLD at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590 overwritten at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590.
WARNING: Method definition h5convert!(Ptr, JLD.JldFile, Bool, JLD.JldWriteSession) in module JLD at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590 overwritten at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:590.
ERROR: TypeError: getfield: expected Symbol, got Int64
 in h5convert!(::Ptr{UInt8}, ::JLD.JldFile, ::Module, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:627
 in #write_compound#15(::Array{Any,1}, ::Any, ::JLD.JldGroup, ::ASCIIString, ::Module, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:693
 in write_ref(::JLD.JldFile, ::Module, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:651
 in h5convert_array(::JLD.JldFile, ::Array{Any,1}, ::JLD.JldDatatype, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:595
 in #_write#11(::Array{Any,1}, ::Any, ::JLD.JldGroup, ::ASCIIString, ::Array{Any,1}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:559
 in write_ref(::JLD.JldFile, ::Array{Any,1}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:651
 [inlined code] from /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:615
 in h5convert!(::Ptr{UInt8}, ::JLD.JldFile, ::LambdaInfo, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:627
 in #write_compound#15(::Array{Any,1}, ::Any, ::JLD.JldGroup, ::ASCIIString, ::LambdaInfo, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:693
 in write_ref(::JLD.JldFile, ::LambdaInfo, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:651
 [inlined code] from /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:615
 in h5convert!(::Ptr{UInt8}, ::JLD.JldFile, ::Nullable{LambdaInfo}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:627
 in #write_compound#15(::Array{Any,1}, ::Any, ::JLD.JldGroup, ::ASCIIString, ::Nullable{LambdaInfo}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:693
 in write_ref(::JLD.JldFile, ::Nullable{LambdaInfo}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:651
 [inlined code] from /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:615
 in h5convert!(::Ptr{UInt8}, ::JLD.JldFile, ::StackFrame, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:627
 in #write_compound#15(::Array{Any,1}, ::Any, ::JLD.JldGroup, ::ASCIIString, ::StackFrame, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:693
 [inlined code] from ./boot.jl:303
 in #_write#14(::Array{Any,1}, ::Any, ::JLD.JldGroup, ::ASCIIString, ::StackFrame, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:687
 in write_ref(::JLD.JldFile, ::StackFrame, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:651
 in h5convert_array(::JLD.JldFile, ::Array{StackFrame,1}, ::JLD.JldDatatype, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:595
 in #_write#11(::Array{Any,1}, ::Any, ::JLD.JldGroup, ::ASCIIString, ::Array{StackFrame,1}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:559
 in write_ref(::JLD.JldFile, ::Array{StackFrame,1}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:651
 [inlined code] from /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:615
 in h5convert!(::Ptr{UInt8}, ::JLD.JldFile, ::JLD.AssociativeWrapper{UInt64,StackFrame,Dict{UInt64,StackFrame}}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/jld_types.jl:627
 in #write_compound#15(::Array{Any,1}, ::Any, ::JLD.JldFile, ::ASCIIString, ::JLD.AssociativeWrapper{UInt64,StackFrame,Dict{UInt64,StackFrame}}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:693
 in #_write#14(::Array{Any,1}, ::Any, ::JLD.JldFile, ::ASCIIString, ::JLD.AssociativeWrapper{UInt64,StackFrame,Dict{UInt64,StackFrame}}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:682
 [inlined code] from ./boot.jl:303
 in #write#8(::Array{Any,1}, ::Any, ::JLD.JldFile, ::ASCIIString, ::Dict{UInt64,StackFrame}, ::JLD.JldWriteSession) at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:682
 in anonymous at /home/kfischer/.julia/v0.5/JLD/src/JLD.jl:1127
 in eval(::Module, ::Any) at ./boot.jl:237
axsk commented 8 years ago

I am getting a similar ERROR: TypeError: getfield: expected Symbol, got Int64 when trying to save a value of composite type, including anonymous function, which I expect to pose the problem in my case (as I experienced problems with them and JLD all along).

timholy commented 8 years ago

For the top case, I don't get the reported error, instead I get ERROR: cannot write a pointer to JLD file. This turns out to be because backtraces now return StackFrame which includes Nullable{LambdaInfo} and LambdaInfo.fptr is of type Ptr{Void}. So someone is going to have to create writeas/readas methods for StackFrame, but of course this will result in the fptr effectively being thrown away.

@axsk, your case doesn't include enough detail to replicate. But anonymous functions are extremely problematic overall, and at the moment it doesn't seem that anyone has a clear path for them going forward with julia-0.5.

cstjean commented 7 years ago

I got this error while saving macroexpanded code that contains module. Eg. JLD.save("temp.jld", "somemodule", Base) triggers it. A nice error message would make it easier to spot the problem.