Skip to content

Memory corruption, segmentation fault, with OncePerThread, Condition, ReentrantLock on v1.12.0-rc1, nightly #58993

@mkitti

Description

@mkitti

OnceHolder.jl with Condition and ReentrantLock (CRL)

OnceHolder.jl

Place the following in a file called OnceHolder.jl.

struct CRL
    condvar::Condition
    lock::ReentrantLock
    CRL() = new(Condition(), ReentrantLock())
end

struct OnceHolder
    once::OncePerThread{CRL}
    OnceHolder() = new(OncePerThread{CRL}(CRL))
end

holder = OnceHolder()
if length(ARGS) > 0
    display(holder)
end
holder.once()
display(holder)

Erroneous Output

When I execute this with either Julia 1.12 or nightly, I get quite random output in place of where ReentrantLock() should go.

% julia +1.12 OnceHolder.jl
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[CRL(Condition(), Base.RefValue{Compiler.CallMeta}(Compiler.CallMeta(Core.Const(AssertionError("")), Union{}, (+c,+e,+n,+t,+s,+m,+u,+o,+r), Compiler.MethodMatchInfo(Compiler.MethodLookupResult(Any[Core.MethodMatch(Tuple{Type{AssertionError}}, svec(), AssertionError() @ Core boot.jl:451, true)], Compiler.WorldRange(0x00000000000000a2, 0xffffffffffffffff), false), Core.GlobalMethods is a Core.MethodTable with 24025 methods., Tuple{Type{AssertionError}}, true, Union{Nothing, Core.CodeInstance}[CodeInstance for MethodInstance for AssertionError()]), nothing))), #undef], UInt8[0x01, 0x00], CRL))

julia +nightly OnceHolder.jl
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[CRL(Condition(), UInt64[0x0000000008000008, 0x000000010d148730, 0x0000000000000000, 0x0000000000000000]), #undef], UInt8[0x01, 0x00], CRL))

Expected Output

I would have expected the following output.

% julia +1.12 OnceHolder.jl
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[CRL(Condition(), ReentrantLock()), #undef], UInt8[0x01, 0x00], CRL))

julia +nightly OnceHolder.jl
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[CRL(Condition(), ReentrantLock()), #undef], UInt8[0x01, 0x00], CRL))

With an Argument

With the above script, if I provide an argument, the situation seems to resolve itself.

% julia +1.12 OnceHolder.jl 1 
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[], UInt8[], CRL))
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[CRL(Condition(), ReentrantLock()), #undef], UInt8[0x01, 0x00], CRL))

% julia +nightly OnceHolder.jl 2
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[], UInt8[], CRL))
OnceHolder(OncePerThread{CRL, Type{CRL}}(CRL[CRL(Condition(), ReentrantLock()), #undef], UInt8[0x01, 0x00], CRL))

OnceHolderX.jl with Condition, Int, and ReentrantLock

OnceHolderX.jl

If I insert an integer into the middle of the struct, I get segmentation faults.

struct CxRL
    condvar::Condition
    x::Int
    lock::ReentrantLock
    CxRL() = new(Condition(), 5, ReentrantLock())
end

struct OnceHolder
    once::OncePerThread{CxRL}
    OnceHolder() = new(OncePerThread{CxRL}(CxRL))
end

holder = OnceHolder()
if length(ARGS) > 0
    display(holder)
end
holder.once()
display(holder)

Segmentation Fault

% julia +1.12 OnceHolderX.jl  
OnceHolder(
[68138] signal 11 (2): Segmentation fault: 11
in expression starting at /Users/kittisopikulm/OnceHolder/OnceHolderX.jl:18
gc_try_claim_and_push at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:1681 [inlined]
gc_mark_memory8 at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:1911
gc_mark_outrefs at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:2429 [inlined]
gc_mark_loop_serial_ at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:2517
gc_mark_loop_serial at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:2540
_jl_gc_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:3073
ijl_gc_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:3461
maybe_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:349 [inlined]
jl_gc_small_alloc_inner at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:725 [inlined]
ijl_gc_small_alloc at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gc-stock.c:774
j_const_prop_argument_heuristic_116245.1 at /Users/kittisopikulm/.julia/juliaup/julia-1.12.0-rc1+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
maybe_get_const_prop_profitable at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:1044
abstract_call_method_with_const_args at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:884
abstract_call_method_with_const_args at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:868
handle1 at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:178
infercalls at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:252
abstract_call_gf_by_type at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:338
abstract_call_known at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2782
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2889
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2882 [inlined]
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3042
abstract_eval_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3060 [inlined]
abstract_eval_statement_expr at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3389
abstract_eval_basic_statement at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3778 [inlined]
abstract_eval_basic_statement at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3735 [inlined]
typeinf_local at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4285
jfptr_typeinf_local_120992.1 at /Users/kittisopikulm/.julia/juliaup/julia-1.12.0-rc1+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
typeinf at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4443
typeinf_ext at ./../usr/share/julia/Compiler/src/typeinfer.jl:1259
typeinf_ext_toplevel at ./../usr/share/julia/Compiler/src/typeinfer.jl:1442 [inlined]
typeinf_ext_toplevel at ./../usr/share/julia/Compiler/src/typeinfer.jl:1451
jfptr_typeinf_ext_toplevel_120716.1 at /Users/kittisopikulm/.julia/juliaup/julia-1.12.0-rc1+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/./julia.h:2374 [inlined]
jl_type_infer at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gf.c:462
jl_compile_method_internal at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gf.c:3302
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gf.c:3792 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/gf.c:4000
_show_default at ./show.jl:504
show_default at ./show.jl:487 [inlined]
show at ./show.jl:482 [inlined]
show at ./multimedia.jl:47
unknown function (ip: 0x10ca1c0d3) at (unknown file)
display at ./multimedia.jl:254
display at ./multimedia.jl:255 [inlined]
display at ./multimedia.jl:340
jfptr_display_99653.1 at /Users/kittisopikulm/.julia/juliaup/julia-1.12.0-rc1+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/./julia.h:2374 [inlined]
do_call at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/interpreter.c:123
eval_stmt_value at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/interpreter.c:194
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/interpreter.c:689
jl_interpret_toplevel_thunk at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/interpreter.c:898
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/toplevel.c:1035
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/toplevel.c:975
ijl_toplevel_eval at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/toplevel.c:1047 [inlined]
ijl_toplevel_eval_in at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/toplevel.c:1092
eval at ./boot.jl:489
include_string at ./loading.jl:2837
_include at ./loading.jl:2897
include at ./Base.jl:303
exec_options at ./client.jl:321
_start at ./client.jl:554
jfptr__start_100270.1 at /Users/kittisopikulm/.julia/juliaup/julia-1.12.0-rc1+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/./julia.h:2374 [inlined]
true_main at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/jlapi.c:971
jl_repl_entrypoint at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-12/src/jlapi.c:1139
Allocations: 797131 (Pool: 797130; Big: 1); GC: 0
zsh: segmentation fault  julia +1.12 OnceHolderX.jl

% julia +nightly OnceHolderX.jl
OnceHolder(
[68148] signal 11 (2): Segmentation fault: 11
in expression starting at /Users/kittisopikulm/OnceHolder/OnceHolderX.jl:18
gc_try_claim_and_push at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:1688 [inlined]
gc_mark_memory8 at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:1918
gc_mark_outrefs at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:2436 [inlined]
gc_mark_loop_serial_ at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:2524
gc_mark_loop_serial at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:2547
_jl_gc_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:3080
ijl_gc_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:3489
maybe_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:349 [inlined]
jl_gc_small_alloc_inner at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:725 [inlined]
ijl_gc_small_alloc at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gc-stock.c:774
Box at ./boot.jl:499 [inlined]
already_inserted_ssa at ./../usr/share/julia/Compiler/src/ssair/passes.jl:365 [inlined]
process_node! at ./../usr/share/julia/Compiler/src/ssair/ir.jl:1464
iterate_compact at ./../usr/share/julia/Compiler/src/ssair/ir.jl:1949
iterate at ./../usr/share/julia/Compiler/src/ssair/ir.jl:1871 [inlined]
batch_inline! at ./../usr/share/julia/Compiler/src/ssair/inlining.jl:683
ssa_inlining_pass! at ./../usr/share/julia/Compiler/src/ssair/inlining.jl:79 [inlined]
run_passes_ipo_safe at ./../usr/share/julia/Compiler/src/optimize.jl:1035
run_passes_ipo_safe at ./../usr/share/julia/Compiler/src/optimize.jl:1048 [inlined]
optimize at ./../usr/share/julia/Compiler/src/optimize.jl:1021
jfptr_optimize_85030.1 at /Users/kittisopikulm/.julia/juliaup/julia-nightly/lib/julia/sys.dylib (unknown line)
finish_nocycle at ./../usr/share/julia/Compiler/src/typeinfer.jl:232
jfptr_finish_nocycle_85482.1 at /Users/kittisopikulm/.julia/juliaup/julia-nightly/lib/julia/sys.dylib (unknown line)
typeinf at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4476
const_prop_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:1348
abstract_call_method_with_const_args at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:898
abstract_call_method_with_const_args at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:868 [inlined]
handle1 at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:178
infercalls at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:252
abstract_call_gf_by_type at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:338
abstract_call_known at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2796
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2903
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2896 [inlined]
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3056
abstract_eval_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3074 [inlined]
abstract_eval_statement_expr at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3430
abstract_eval_basic_statement at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3805 [inlined]
abstract_eval_basic_statement at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3762 [inlined]
typeinf_local at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4311
jfptr_typeinf_local_83085.1 at /Users/kittisopikulm/.julia/juliaup/julia-nightly/lib/julia/sys.dylib (unknown line)
typeinf at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4469
const_prop_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:1348
abstract_call_method_with_const_args at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:898
abstract_call_method_with_const_args at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:868 [inlined]
handle1 at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:178
infercalls at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:252
abstract_call_gf_by_type at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:338
abstract_call_known at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2796
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2903
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:2896 [inlined]
abstract_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3056
abstract_eval_call at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3074 [inlined]
abstract_eval_statement_expr at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3430
abstract_eval_basic_statement at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3805 [inlined]
abstract_eval_basic_statement at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:3762 [inlined]
typeinf_local at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4311
jfptr_typeinf_local_83085.1 at /Users/kittisopikulm/.julia/juliaup/julia-nightly/lib/julia/sys.dylib (unknown line)
typeinf at ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4469
typeinf_ext at ./../usr/share/julia/Compiler/src/typeinfer.jl:1378
typeinf_ext_toplevel at ./../usr/share/julia/Compiler/src/typeinfer.jl:1561 [inlined]
typeinf_ext_toplevel at ./../usr/share/julia/Compiler/src/typeinfer.jl:1570
jfptr_typeinf_ext_toplevel_83677.1 at /Users/kittisopikulm/.julia/juliaup/julia-nightly/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/./julia.h:2345 [inlined]
jl_type_infer at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gf.c:462
jl_compile_method_internal at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gf.c:3292
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gf.c:3785 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/gf.c:3993
_show_default at ./show.jl:511
show_default at ./show.jl:494 [inlined]
show at ./show.jl:489 [inlined]
show at ./multimedia.jl:47
unknown function (ip: 0x110fcc0db) at (unknown file)
display at ./multimedia.jl:254
display at ./multimedia.jl:255 [inlined]
display at ./multimedia.jl:340
jfptr_display_73681.1 at /Users/kittisopikulm/.julia/juliaup/julia-nightly/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/./julia.h:2345 [inlined]
do_call at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/interpreter.c:123
eval_stmt_value at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/interpreter.c:194
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/interpreter.c:690
jl_interpret_toplevel_thunk at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/interpreter.c:899
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/toplevel.c:773
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/toplevel.c:713
ijl_toplevel_eval at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/toplevel.c:785 [inlined]
ijl_toplevel_eval_in at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/toplevel.c:830
eval at ./boot.jl:489
include_string at ./loading.jl:2848
_include at ./loading.jl:2908
include at ./Base.jl:309
exec_options at ./client.jl:320
_start at ./client.jl:553
jfptr__start_27320.1 at /Users/kittisopikulm/.julia/juliaup/julia-nightly/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/./julia.h:2345 [inlined]
true_main at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/jlapi.c:971
jl_repl_entrypoint at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-master/src/jlapi.c:1138
Allocations: 802804 (Pool: 802803; Big: 1); GC: 0
zsh: segmentation fault  julia +nightly OnceHolderX.jl

With an argument

However, if I add an argument to the script, then the situation resolves.

% julia +1.12 OnceHolderX.jl 1  
OnceHolder(OncePerThread{CxRL, Type{CxRL}}(CxRL[], UInt8[], CxRL))
OnceHolder(OncePerThread{CxRL, Type{CxRL}}(CxRL[CxRL(Condition(), 5, ReentrantLock()), #undef], UInt8[0x01, 0x00], CxRL))

% julia +1.12 OnceHolderX.jl 2
OnceHolder(OncePerThread{CxRL, Type{CxRL}}(CxRL[], UInt8[], CxRL))
OnceHolder(OncePerThread{CxRL, Type{CxRL}}(CxRL[CxRL(Condition(), 5, ReentrantLock()), #undef], UInt8[0x01, 0x00], CxRL))

Julia versions involved: v1.12.0-rc1 and nightly (1.13.0-DEV.861), Linux and macOS

This is issues occurs for me on Julia 1.12.0-rc1 and nightly (1.13.0-DEV.861) on both macOS and Linux.

% julia +1.12 -e "using InteractiveUtils; versioninfo()"
Julia Version 1.12.0-rc1
Commit 228edd6610b (2025-07-12 20:11 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m1)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)

% julia +nightly -e "using InteractiveUtils; versioninfo()"
Julia Version 1.13.0-DEV.861
Commit 1367b3d7ad7 (2025-07-14 00:01 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LLVM: libLLVM-20.1.2 (ORCJIT, apple-m1)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)

$ julia +1.12 -e "using InteractiveUtils; versioninfo()"
Julia Version 1.12.0-rc1
Commit 228edd6610b (2025-07-12 20:11 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD FX(tm)-8350 Eight-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, bdver1)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)

$ julia +nightly -e "using InteractiveUtils; versioninfo()"
Julia Version 1.13.0-DEV.861
Commit 1367b3d7ad7 (2025-07-14 00:01 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD FX(tm)-8350 Eight-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-20.1.2 (ORCJIT, bdver1)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)

Metadata

Metadata

Assignees

Labels

multithreadingBase.Threads and related functionality

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions