Seg fault when saving files with JLD2 in WSL

The installation of JLD2 in WSL is passed successfully. However, the test code goes wrong:

using JLD2, FileIO
hello = "world"
foo = :bar
@save "example.jld2" hello foo

The error message is:

signal (11): Segmentation fault
in expression starting at no file:0
_write at ./pointer.jl:155 [inlined]
write at /home/cyb/.julia/packages/JLD2/IASHd/src/misc.jl:27 [inlined]
write_object_header_and_dataspace_message at /home/cyb/.julia/packages/JLD2/IASHd/src/datasets.jl:435
write_dataset at /home/cyb/.julia/packages/JLD2/IASHd/src/datasets.jl:423
write_dataset at /home/cyb/.julia/packages/JLD2/IASHd/src/datasets.jl:521 [inlined]
write at /home/cyb/.julia/packages/JLD2/IASHd/src/groups.jl:119
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
write at /home/cyb/.julia/packages/JLD2/IASHd/src/JLD2.jl:327
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
#3 at /home/cyb/.julia/packages/JLD2/IASHd/src/loadsave.jl:50
#jldopen#31 at /home/cyb/.julia/packages/JLD2/IASHd/src/loadsave.jl:4
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jldopen at /home/cyb/.julia/packages/JLD2/IASHd/src/loadsave.jl:2
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:324
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:428
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:363 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:686
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:799
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f2f65c8ea8f)
unknown function (ip: 0x6)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:808
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:787
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/builtins.c:622
eval at ./boot.jl:319
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1536 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:268
unknown function (ip: 0xffffffffffffffff)
Allocations: 19278462 (Pool: 19274441; Big: 4021); GC: 41
Segmentation fault (core dumped)

Same code succeded in saving files with JLD2 in the Windows version of julia.
Is that a Julia, JLD2 or WSL issue?

What is WSL? Google tells me its the World Surf League. :sunglasses:

Windows subsystem Linux. I cannot repeat it on Mac. We need someone with WSL I guess…

I can reproduce this in Julia 1.0 on WSL on Windows 10.

This also happens on the current master.

Error message:

signal (11): Segmentation fault
in expression starting at no file:0
_write at ./pointer.jl:155 [inlined]
write at /home/<snip>/.julia/packages/JLD2/IASHd/src/misc.jl:27 [inlined]
write_object_header_and_dataspace_message at /home/<snip>/.julia/packages/JLD2/IASHd/src/datasets.jl:435
write_dataset at /home/<snip>/.julia/packages/JLD2/IASHd/src/datasets.jl:423
write_dataset at /home/<snip>/.julia/packages/JLD2/IASHd/src/datasets.jl:521 [inlined]
write at /home/<snip>/.julia/packages/JLD2/IASHd/src/groups.jl:119
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
write at /home/<snip>/.julia/packages/JLD2/IASHd/src/JLD2.jl:327
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
#3 at /home/<snip>/.julia/packages/JLD2/IASHd/src/loadsave.jl:50
#jldopen#31 at /home/<snip>/.julia/packages/JLD2/IASHd/src/loadsave.jl:4
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jldopen at /home/<snip>/.julia/packages/JLD2/IASHd/src/loadsave.jl:2
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:324
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:428
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:363 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:686
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:799
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7faa13315c2f)
unknown function (ip: 0x6)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:808
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:787
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/builtins.c:622
eval at ./boot.jl:319
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1536 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:268
unknown function (ip: 0xffffffffffffffff)
Allocations: 21435105 (Pool: 21430885; Big: 4220); GC: 46
Segmentation fault (core dumped)

There are definitely some mysterious segfaults lurking in the shadows in JLD2, I have also seen this on real linux. I have never been able to track them down but I have not looked very hard. It may be my imagination, but I suspect it occurs somewhere in the handling of mutable types.

Folks, anyone managed to solve it?

I “think” I have a very similar problem. Windows 10 running VirtualBox with Ubuntu in it.
every time I run above code in my virtual linux with file destination in a folders mounted from Windows I get a crash.

note, I can perfectly fine write to that destination from other application in linux (say echo 122 > test.txt). Also julia can perfectly fine save to a “native” linux folder (say directly to my home folder in linux). Moreover, I can READ jld2 files in julia from folders mounted from windows. so no obvious problems on the linux or julia side. just julia and windows mounted folders seems to have problems.

I upgraded virtual box to 6.0.12 and (very important) guest extensions. And the problem is gone, can write jld2 files from julia directly to partitions mounted from windows (at has been bothering me for a year now, since my fresh install of VirtualBix), I guess VirtualBox fixed something here.

Does using JLSO.jl instead solve the problem?