JLD.jl
JLD.jl copied to clipboard
StackOverflow when saving TimerOutput
See https://github.com/KristofferC/TimerOutputs.jl/issues/40. Saving a TimerOutput
produces a StackOverflow error with JLD but works with JLD2.
using Timeroutputs, JLD
to = TimerOutput()
@timeit to "rand"
@save "to.jld" to
I (think I) could trace this down to
_write(parent::Union{JldFile, JldGroup}, name::String, s,
wsession::JldWriteSession; kargs...) =
write_compound(parent, name, s, wsession)
function write_compound(parent::Union{JldFile, JldGroup}, name::String,
s, wsession::JldWriteSession; kargs...)
T = typeof(s)
f = file(parent)
dtype = h5type(f, T, true)
gen_h5convert(f, T)
buf = Vector{UInt8}(undef, HDF5.h5t_get_size(dtype))
h5convert!(pointer(buf), file(parent), s, wsession)
gcuse(buf)
dspace = HDF5Dataspace(HDF5.h5s_create(HDF5.H5S_SCALAR))
dprop, dprop_close = dset_create_properties(parent, length(buf), buf; kargs...)
try
dset = HDF5.d_create(parent.plain, name, dtype.dtype, dspace, HDF5._link_properties(name), dprop)
HDF5.writearray(dset, dtype.dtype.id, buf)
return dset
finally
dprop_close && close(dprop)
close(dspace)
end
end
In particular, HDF5.writearray(dset, dtype.dtype.id, buf)
apparently leads to an infinite loop:
julia> HDF5.writearray(dset, dtype.dtype.id, buf)
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffa12b6d0b0 -- strlen at C:\Windows\System32\msvcrt.dll (unknown line)
in expression starting at no file:0
strlen at C:\Windows\System32\msvcrt.dll (unknown line)
H5T__conv_vlen at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
H5T_convert at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
H5T__conv_struct_opt at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
H5T_convert at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
H5D__scatgath_write at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
H5D__contig_write at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
H5D_flush at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
H5Dwrite at C:\Users\carsten\.julia\packages\WinRPM\Y9QdZ\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL (unknown line)
h5d_write at C:\Users\carsten\.julia\packages\HDF5\b6QoH\src\HDF5.jl:2131 [inlined]
h5d_write at C:\Users\carsten\.julia\packages\HDF5\b6QoH\src\HDF5.jl:1985 [inlined]
writearray at C:\Users\carsten\.julia\packages\HDF5\b6QoH\src\HDF5.jl:1872
unknown function (ip: 0000000001026474)
jl_fptr_trampoline at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1831
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2184
do_call at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:324
eval_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:430
eval_stmt_value at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:363 [inlined]
eval_body at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:678
jl_interpret_toplevel_thunk_callback at /home/Administrator/buildbot/worker/package_win64/build/src\interpreter.c:806
unknown function (ip: FFFFFFFFFFFFFFFE)
unknown function (ip: 000000000720A12F)
unknown function (ip: 0000000000000002)
jl_toplevel_eval_flex at /home/Administrator/buildbot/worker/package_win64/build/src\toplevel.c:805
jl_toplevel_eval_in at /home/Administrator/buildbot/worker/package_win64/build/src\builtins.c:622
eval at .\boot.jl:319
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2184
eval_user_input at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\REPL\src\REPL.jl:85
run_backend at C:\Users\carsten\.julia\packages\Revise\TmjcT\src\Revise.jl:766
#58 at .\task.jl:259
jl_fptr_trampoline at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:1831
jl_apply_generic at /home/Administrator/buildbot/worker/package_win64/build/src\gf.c:2184
jl_apply at /home/Administrator/buildbot/worker/package_win64/build/src\julia.h:1537 [inlined]
start_task at /home/Administrator/buildbot/worker/package_win64/build/src\task.c:268
Allocations: 60712281 (Pool: 60698009; Big: 14272); GC: 134
HDF5: infinite loop closing library
D,G,A,S,T,F,FD,P,FD,P,FD,P,E,E,SL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL
Any idea how to fix this?
I think a recursive self-reference field causes a StackOverflowError
when trying to save with JLD
.
using JLD, JLD2, BSON
mutable struct Self
self::Self
function Self()
this = new()
this.self = this
end
end
self = Self()
d = Dict("self" => self)
filename = joinpath(mktempdir(), "test")
save(string(filename, ".jld2"), d) # OK
save(string(filename, ".bson"), d) # OK
save(string(filename, ".jld"), d) # causes StackOverflowError