Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure on nightly: scopedvalue + try/catch/finally #56062

Closed
simonbyrne opened this issue Oct 9, 2024 · 5 comments · Fixed by #57186
Closed

Assertion failure on nightly: scopedvalue + try/catch/finally #56062

simonbyrne opened this issue Oct 9, 2024 · 5 comments · Fixed by #57186
Assignees
Labels
bisect wanted bug Indicates an unexpected problem or unintended behavior error handling Handling of exceptions by Julia or the user GC Garbage collector

Comments

@simonbyrne
Copy link
Contributor

simonbyrne commented Oct 9, 2024

On the current nightly (8d515ed), the following triggers an assertion failure on both Linux and MacOS

using Base.ScopedValues: @with

ts = Int[]
try
    @with begin
        return
    end
catch err
finally
    push!(ts, 2)
end
@simonbyrne simonbyrne changed the title Segfault on nightly Segfault on nightly: scopedvalue + try/catch/finally Oct 9, 2024
@simonbyrne simonbyrne added the bug Indicates an unexpected problem or unintended behavior label Oct 9, 2024
@nsajko
Copy link
Contributor

nsajko commented Oct 9, 2024

An assertion is also tripped:

julia: /cache/build/tester-amdci4-10/julialang/julia-master/src/rtutils.c:312: ijl_eh_restore_state_noexcept: Assertion `ct->gcstack == eh->gcstack && "Incorrect GC usage under try catch"' failed.

[38054] signal 6 (-6): Aborted
in expression starting at none:5
unknown function (ip: 0x7042046f73f4)
gsignal at /usr/lib/libc.so.6 (unknown line)
abort at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x7042046853de)
__assert_fail at /usr/lib/libc.so.6 (unknown line)
ijl_eh_restore_state_noexcept at /cache/build/tester-amdci4-10/julialang/julia-master/src/rtutils.c:312 [inlined]
ijl_eh_restore_state_noexcept at /cache/build/tester-amdci4-10/julialang/julia-master/src/rtutils.c:310
eval_body at /cache/build/tester-amdci4-10/julialang/julia-master/src/interpreter.c:551
jl_interpret_toplevel_thunk at /cache/build/tester-amdci4-10/julialang/julia-master/src/interpreter.c:892
jl_toplevel_eval_flex at /cache/build/tester-amdci4-10/julialang/julia-master/src/toplevel.c:1047
jl_toplevel_eval_flex at /cache/build/tester-amdci4-10/julialang/julia-master/src/toplevel.c:987
ijl_toplevel_eval at /cache/build/tester-amdci4-10/julialang/julia-master/src/toplevel.c:1058
ijl_toplevel_eval_in at /cache/build/tester-amdci4-10/julialang/julia-master/src/toplevel.c:1100
eval at ./boot.jl:439 [inlined]
exec_options at ./client.jl:295
_start at ./client.jl:558
jfptr__start_65901.1 at /home/nsajko/tmp/jl/jl/build_assert/julia-4cdd864e53/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/tester-amdci4-10/julialang/julia-master/src/gf.c:3274 [inlined]
ijl_apply_generic at /cache/build/tester-amdci4-10/julialang/julia-master/src/gf.c:3462
jl_apply at /cache/build/tester-amdci4-10/julialang/julia-master/src/julia.h:2228 [inlined]
true_main at /cache/build/tester-amdci4-10/julialang/julia-master/src/jlapi.c:900
jl_repl_entrypoint at /cache/build/tester-amdci4-10/julialang/julia-master/src/jlapi.c:1059
main at /cache/build/tester-amdci4-10/julialang/julia-master/cli/loader_exe.c:58
unknown function (ip: 0x704204686e07)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)
Allocations: 1 (Pool: 1; Big: 0); GC: 0
Aborted (core dumped)
Julia Version 1.12.0-DEV.1327
Commit 4cdd864e535 (2024-10-07 23:54 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver2)
Threads: 6 default, 0 interactive, 6 GC (on 8 virtual cores)

@nsajko nsajko added error handling Handling of exceptions by Julia or the user GC Garbage collector labels Oct 9, 2024
@simonbyrne simonbyrne changed the title Segfault on nightly: scopedvalue + try/catch/finally Assertion failure on nightly: scopedvalue + try/catch/finally Oct 24, 2024
@simonbyrne
Copy link
Contributor Author

bump? any thoughts?

@adienes
Copy link
Contributor

adienes commented Jan 24, 2025

on my machine this does not error on 8d515ed, nor does it on current master.

julia> versioninfo()
Julia Version 1.12.0-DEV.1931
Commit 6eb42dbc69 (2025-01-24 01:23 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin24.2.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, 0 interactive, 1 GC (on 8 virtual cores)

@nsajko
Copy link
Contributor

nsajko commented Jan 24, 2025

On my machine this reproduces on all v1.11 releases. Furthermore, it also reproduces using the ScopedValues.jl package instead of Base.ScopedValues. EDIT: but not on v1.10. EDIT: oh, I guess that's because the ScopedValues package just uses Base.ScopedValues on v1.11 and up?

@nsajko
Copy link
Contributor

nsajko commented Jan 24, 2025

It's not fixed on master, sorry if my previous message isn't clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bisect wanted bug Indicates an unexpected problem or unintended behavior error handling Handling of exceptions by Julia or the user GC Garbage collector
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants