Skip to content

Internal BoundsError in the compiler #37154

Closed
@benhamad

Description

@benhamad

The following code causes an internal error in Julia 1.4.2 ( and 1.5.0, see my other comment below)

update_lock = Threads.ReentrantLock()
function update()
    while(true)
        try
            for i in 1:1
                lock(update_lock)
                counter += 1
                unlock(update_lock)
            end
        catch e
            nothing
        end
    end
end

You will need to manually kill the server due to the infinite loop 😅. The logic behind the code is to keep trying something that can result in an exception, if it does, do some handling and then go back trying that thing again, until a global state has changed and then we exist.

Internal error: encountered unexpected error in runtime:
BoundsError(a=Array{Core.Compiler.BasicBlock, (5,)}[
  Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=1, stop=2), preds=Array{Int64, (1,)}[5], succs=Array{Int64, (1,)}[2]),
  Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=3, stop=5), preds=Array{Int64, (1,)}[1], succs=Array{Int64, (2,)}[4, 3]),
  Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=6, stop=11), preds=Array{Int64, (1,)}[2], succs=Array{Int64, (0,)}[]),
  Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=12, stop=14), preds=Array{Int64, (1,)}[2], succs=Array{Int64, (1,)}[5]),
  Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=15, stop=16), preds=Array{Int64, (1,)}[4], succs=Array{Int64, (1,)}[1])], i=(0,))
jl_bounds_error_ints at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
getindex at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
jfptr_getindex_1956 at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
jl_apply_generic at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
replace_code_newstyle! at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
optimize at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
typeinf at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
typeinf_ext at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
typeinf_ext at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
jfptr_typeinf_ext_1 at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
jl_apply_generic at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
jl_type_infer at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
jl_compile_method_internal at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
jl_apply_generic at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
do_call at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
eval_value at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
eval_body at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
jl_interpret_toplevel_thunk at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
top-level scope at REPL[2]:1
jl_toplevel_eval_flex at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
jl_toplevel_eval_flex at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
jl_toplevel_eval_in at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
eval at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
jl_apply_generic at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
eval_user_input at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
#26 at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/lib/julia/sys.so (unknown line)
jl_apply_generic at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
start_task at /nix/store/kbcgz4zm5vs3sprmj45jc2lhrffmld22-julia-1.4.2-patched/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: (nil))

This error seems to be related to #30093

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:optimizerOptimization passes (mostly in base/compiler/ssair/)priorityThis should be addressed urgently

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions