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

Segfault in heavily nested function call #56690

Closed
serenity4 opened this issue Nov 26, 2024 · 5 comments · Fixed by #57047
Closed

Segfault in heavily nested function call #56690

serenity4 opened this issue Nov 26, 2024 · 5 comments · Fixed by #57047
Labels
bug Indicates an unexpected problem or unintended behavior regression 1.12 Regression in the 1.12 release
Milestone

Comments

@serenity4
Copy link
Contributor

serenity4 commented Nov 26, 2024

I get a segfault on nightly for the SymbolicGA.jl package:

(@v1.12) pkg> activate --temp
  Activating new project at `/tmp/jl_Q2CEQp`

(jl_Q2CEQp) pkg> add SymbolicGA#segfault-reproducer
... [truncated]

julia> using SymbolicGA: @ga

julia> @ga 2 (1, (1, 2))::(0, 1)

[97611] signal 11 (1): Segmentation fault
in expression starting at REPL[4]:1
_jl_invoke at /cache/build/builder-amdci5-3/julialang/julia-master/src/gf.c:3284 [inlined]
ijl_invoke at /cache/build/builder-amdci5-3/julialang/julia-master/src/gf.c:3313
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816
unknown function (ip: 0x7f18a7b98927) at (unknown file)
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:828
unknown function (ip: 0x7f18a7b987d9) at (unknown file)
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816 [inlined]
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:821 [inlined]
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816
unknown function (ip: 0x7f18a7b987a0) at (unknown file)
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:828
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:828
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:828
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:828
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:828
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816 [inlined]
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816 [inlined]
gather_scalar_expressions! at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/optimization.jl:61 [inlined]
gather_scalar_expressions at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/optimization.jl:28 [inlined]
IterativeRefinement at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/optimization.jl:26 [inlined]
optimize! at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/optimization.jl:53 [inlined]
#generate_expression#65 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:190
generate_expression at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:186 [inlined]
#codegen_expression#67 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:211
codegen_expression at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:209
#codegen_expression#66 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:206
unknown function (ip: 0x7f18a7b48d1a) at (unknown file)
codegen_expression at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:206
unknown function (ip: 0x7f18a7b45cda) at (unknown file)
@ga at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:49
jl_invoke_julia_macro at /cache/build/builder-amdci5-3/julialang/julia-master/src/ast.c:1173
jl_expand_macros at /cache/build/builder-amdci5-3/julialang/julia-master/src/ast.c:1235
[...] (truncated, C lines)

Allocations: 33948422 (Pool: 33933839; Big: 14583); GC: 22
fish: Job 1, '$jlpath --color=yes -tauto $argv' terminated by signal SIGSEGV (Address boundary error)

If uncommenting the line that was commented here: serenity4/SymbolicGA.jl@3fe2ccc, with the same reproducer (setting it up with pkg> add SymbolicGA#lookup-error instead), I instead get an undefined symbol:

(@v1.12) pkg> activate --temp
  Activating new project at `/tmp/jl_Q2CEQp`

(jl_Q2CEQp) pkg> add SymbolicGA#lookup-error
... [truncated]

julia> using SymbolicGA: @ga

julia> @ga 2 (1, (1, 2))::(0, 1)
/home/serenity4/.julia/juliaup/julia-nightly/bin/julia: symbol lookup error: /home/serenity4/.julia/compiled/v1.12/SymbolicGA/krY9u_Z0AFz.so: undefined symbol: jl_fptr_sparam
Version info
julia> versioninfo()
Julia Version 1.12.0-DEV.1690
Commit 81568a6dc1b (2024-11-25 13:17 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900F
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
Threads: 32 default, 0 interactive, 32 GC (on 32 virtual cores)
Environment:
  JULIA_INFO_COLOR = green

Everything works fine on 1.11.

@serenity4
Copy link
Contributor Author

serenity4 commented Nov 27, 2024

git bisect indicates that the first bad commit for the segfault is: c31710a (#54899)

The lookup error is older, will open a separate issue for it.

EDIT: #56701

@giordano
Copy link
Contributor

git bisect indicates that the first bad commit for the segfault is: c31710a (#54899)

CC: @vtjnash.

@serenity4
Copy link
Contributor Author

Should we mark this issue and #56701 as 1.12 regressions and add them to the 1.12 milestone? This seems serious enough to warrant attention before releasing 1.12.

@giordano giordano added this to the 1.12 milestone Jan 5, 2025
@vtjnash
Copy link
Member

vtjnash commented Jan 5, 2025

Fixed by #56817

@vtjnash vtjnash closed this as completed Jan 5, 2025
@serenity4
Copy link
Contributor Author

Sweet! I got another segfault, very similar to this issue

(@v1.12) pkg> activate --temp
  Activating new project at `/tmp/jl_8wkX5V`

(jl_8wkX5V) pkg> add SymbolicGA#segfault-reproducer

julia> using SymbolicGA: @ga

julia> @ga 2 (1, (1, 2))::(0, 1); # this now works

julia> @ga 3 (1, 2, 3)::Vector × 1f0::e1 # this still doesn't

[3585] signal 11 (1): Segmentation fault
in expression starting at REPL[5]:1
_jl_invoke at /cache/build/builder-demeter6-7/julialang/julia-master/src/gf.c:3422 [inlined]
ijl_invoke at /cache/build/builder-demeter6-7/julialang/julia-master/src/gf.c:3451
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816 [inlined]
#traverse#51 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:828
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816 [inlined]
traverse at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:816 [inlined]
leaf_factorization_terms at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/factorization.jl:81 [inlined]
replace_with_factorized! at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/factorization.jl:73
#factorize!##0 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/factorization.jl:92 [inlined]
#traverse_indexed#55 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:833
traverse_indexed at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:832 [inlined]
#traverse_indexed#55 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:845
traverse_indexed at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:832 [inlined]
#traverse_indexed#55 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:845
traverse_indexed at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:832
#traverse_indexed#55 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:845
traverse_indexed at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:832
traverse_indexed at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/expressions.jl:832
factorize! at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/factorization.jl:92 [inlined]
factorize! at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/factorization.jl:89 [inlined]
#generate_expression#65 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:189
generate_expression at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:186 [inlined]
#codegen_expression#67 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:211 [inlined]
codegen_expression at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:209
#codegen_expression#66 at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:206
unknown function (ip: 0x7f76d0f2c8ba) at (unknown file)
codegen_expression at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:206
unknown function (ip: 0x7f76d0f296aa) at (unknown file)
@ga at /home/serenity4/.julia/packages/SymbolicGA/bCHM9/src/macro.jl:49
jl_invoke_julia_macro at /cache/build/builder-demeter6-7/julialang/julia-master/src/ast.c:1138
jl_expand_macros at /cache/build/builder-demeter6-7/julialang/julia-master/src/ast.c:1200
jl_expand_macros at /cache/build/builder-demeter6-7/julialang/julia-master/src/ast.c:1249 [inlined]
jl_expand_in_world at /cache/build/builder-demeter6-7/julialang/julia-master/src/ast.c:1299
__repl_entry_lower_with_loc at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:339
jl_apply at /cache/build/builder-demeter6-7/julialang/julia-master/src/julia.h:2246 [inlined]
jl_f__call_latest at /cache/build/builder-demeter6-7/julialang/julia-master/src/builtins.c:883
#invokelatest#1 at ./essentials.jl:1056 [inlined]
invokelatest at ./essentials.jl:1052 [inlined]
toplevel_eval_with_hooks at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:346
toplevel_eval_with_hooks at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:352
toplevel_eval_with_hooks at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:345 [inlined]
eval_user_input at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:370
repl_backend_loop at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:482
#start_repl_backend#41 at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:467
start_repl_backend at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:464 [inlined]
#run_repl#48 at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:690
run_repl at /cache/build/builder-demeter6-7/julialang/julia-master/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:676
jfptr_run_repl_26070.1 at /home/serenity4/.julia/juliaup/julia-nightly/share/julia/compiled/v1.12/REPL/u0gqU_WFKhp.so (unknown line)
run_std_repl at ./client.jl:490
jfptr_run_std_repl_58353.1 at /home/serenity4/.julia/juliaup/julia-nightly/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/builder-demeter6-7/julialang/julia-master/src/julia.h:2246 [inlined]
jl_f__call_latest at /cache/build/builder-demeter6-7/julialang/julia-master/src/builtins.c:883
#invokelatest#1 at ./essentials.jl:1056 [inlined]
invokelatest at ./essentials.jl:1052 [inlined]
run_main_repl at ./client.jl:511
repl_main at ./client.jl:593 [inlined]
_start at ./client.jl:568
jfptr__start_57578.1 at /home/serenity4/.julia/juliaup/julia-nightly/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/builder-demeter6-7/julialang/julia-master/src/julia.h:2246 [inlined]
true_main at /cache/build/builder-demeter6-7/julialang/julia-master/src/jlapi.c:922
jl_repl_entrypoint at /cache/build/builder-demeter6-7/julialang/julia-master/src/jlapi.c:1081
main at /cache/build/builder-demeter6-7/julialang/julia-master/cli/loader_exe.c:58
unknown function (ip: 0x7f76de558e07) at /usr/lib/libc.so.6
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8) at /workspace/srcdir/glibc-2.17/csu/../sysdeps/x86_64/start.S
Allocations: 43524877 (Pool: 43510208; Big: 14669); GC: 18
fish: Job 1, '~/.cargo/bin/julia +nightly --s…' terminated by signal SIGSEGV (Address boundary error)

Shall we reopen this one, or file another issue?

vtjnash added a commit that referenced this issue Jan 14, 2025
vtjnash added a commit that referenced this issue Jan 14, 2025
@oscardssmith oscardssmith added bug Indicates an unexpected problem or unintended behavior regression 1.12 Regression in the 1.12 release labels Jan 14, 2025
@aviatesk aviatesk reopened this Jan 15, 2025
vtjnash added a commit that referenced this issue Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior regression 1.12 Regression in the 1.12 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants