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

Segmentation fault during __init__ #459

Closed
lgoettgens opened this issue Dec 3, 2024 · 2 comments
Closed

Segmentation fault during __init__ #459

lgoettgens opened this issue Dec 3, 2024 · 2 comments

Comments

@lgoettgens
Copy link
Contributor

Our corresponding downstream issue is oscar-system/Oscar.jl#3904.

On julia 1.11, we randomly see segmentation faults during the execution of CxxWrap's __init__ function like the following one:

[3419] signal 11 (1): Segmentation fault
in expression starting at /home/runner/work/Oscar.jl/Oscar.jl/test/runtests.jl:1
jl_datatype_layout at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:1338 [inlined]
immut_id_ at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/builtins.c:393
jl_idset_peek_bp at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/idset.c:34
jl_idset_get at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/idset.c:40
jl_as_global_root at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/staticdata.c:2521 [inlined]
jl_as_global_root at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/staticdata.c:2501
inst_datatype_inner at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jltypes.c:2115
jl_inst_arg_tuple_type at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jltypes.c:2338
arg_type_tuple at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/gf.c:2278 [inlined]
jl_lookup_generic_ at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/gf.c:3074 [inlined]
ijl_apply_generic at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/gf.c:3121
initialize_julia_module at /home/runner/.julia/packages/CxxWrap/eWADG/src/CxxWrap.jl:436
__init__ at /home/runner/.julia/packages/CxxWrap/eWADG/src/StdLib.jl:25
jfptr___init___45546 at /home/runner/.julia/compiled/v1.11/CxxWrap/WGIJU_fFeoo.so (unknown line)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_module_run_initializer at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:76
run_module_init at ./loading.jl:1378
register_restored_modules at ./loading.jl:1366
#_include_from_serialized#1082 at ./loading.jl:1254
_include_from_serialized at ./loading.jl:1210 [inlined]
_include_from_serialized at ./loading.jl:1210 [inlined]
#_require_search_from_serialized#1105 at ./loading.jl:2041
_require_search_from_serialized at ./loading.jl:1969
jfptr__require_search_from_serialized_44818.1 at /opt/hostedtoolcache/julia/1.11-nightly/x64/lib/julia/sys.so (unknown line)
_require at ./loading.jl:2527
__require_prelocked at ./loading.jl:2388
jfptr___require_prelocked_71171.1 at /opt/hostedtoolcache/julia/1.11-nightly/x64/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_f__call_in_world at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/builtins.c:894
#invoke_in_world#3 at ./essentials.jl:1089 [inlined]
invoke_in_world at ./essentials.jl:1086 [inlined]
_require_prelocked at ./loading.jl:2375
macro expansion at ./loading.jl:2314 [inlined]
macro expansion at ./lock.jl:273 [inlined]
__require at ./loading.jl:2271
jfptr___require_71102.1 at /opt/hostedtoolcache/julia/1.11-nightly/x64/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_f__call_in_world at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/builtins.c:894
#invoke_in_world#3 at ./essentials.jl:1089 [inlined]
invoke_in_world at ./essentials.jl:1086 [inlined]
require at ./loading.jl:2260
jfptr_require_71099.1 at /opt/hostedtoolcache/julia/1.11-nightly/x64/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
call_require at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:486 [inlined]
eval_import_path at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:523
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:759
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:886
ijl_toplevel_eval_in at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:994
eval at ./boot.jl:430 [inlined]
include_string at ./loading.jl:2734
_include at ./loading.jl:2794
include at ./sysimg.jl:38
unknown function (ip: 0x7f4921500082)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
do_call at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:126
eval_value at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:223
eval_stmt_value at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:174 [inlined]
eval_body at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:663
jl_interpret_toplevel_thunk at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/interpreter.c:821
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:943
jl_toplevel_eval_flex at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:886
ijl_toplevel_eval_in at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/toplevel.c:994
eval at ./boot.jl:430 [inlined]
exec_options at ./client.jl:296
_start at ./client.jl:531
jfptr__start_7[340](https://github.com/oscar-system/Oscar.jl/actions/runs/12136706312/job/33838373809#step:10:343)6.1 at /opt/hostedtoolcache/julia/1.11-nightly/x64/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
true_main at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jlapi.c:900
jl_repl_entrypoint at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jlapi.c:1059
main at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/cli/loader_exe.c:58
unknown function (ip: 0x7f4922a29d8f)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)
Allocations: 1579612 (Pool: 1579527; Big: 85); GC: 3
Package Oscar errored during testing (received signal: 11)

https://github.com/oscar-system/Oscar.jl/actions/runs/12136706312/job/33838373809#step:10:327

I believe we haven't experienced anything similar on 1.12-nightly yet (please correct me if I am wrong @benlorenz).

At the beginning of the above-referenced issue, we were still using an outdated CxxWrap. However, regarding the more recent occurrences, we are running with CxxWrap v0.16.0 and libcxxwrap_julia_jll v0.13.2+0.

@benlorenz
Copy link
Contributor

benlorenz commented Dec 3, 2024

I have opened a PR for libcxxwrap-julia which should fix (or at least improve) this: JuliaInterop/libcxxwrap-julia#177

On julia 1.11, we randomly see segmentation faults during the execution of CxxWrap's __init__ function like the following one:

[3419] signal 11 (1): Segmentation fault
in expression starting at /home/runner/work/Oscar.jl/Oscar.jl/test/runtests.jl:1
jl_datatype_layout at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/julia.h:1338 [inlined]
immut_id_ at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/builtins.c:393
jl_idset_peek_bp at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/idset.c:34
jl_idset_get at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/idset.c:40
jl_as_global_root at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/staticdata.c:2521 [inlined]
jl_as_global_root at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/staticdata.c:2501
inst_datatype_inner at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jltypes.c:2115
jl_inst_arg_tuple_type at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/jltypes.c:2338
arg_type_tuple at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/gf.c:2278 [inlined]
jl_lookup_generic_ at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/gf.c:3074 [inlined]
ijl_apply_generic at /cache/build/tester-amdci5-12/julialang/julia-release-1-dot-11/src/gf.c:3121
initialize_julia_module at /home/runner/.julia/packages/CxxWrap/eWADG/src/CxxWrap.jl:436
__init__ at /home/runner/.julia/packages/CxxWrap/eWADG/src/StdLib.jl:25
jfptr___init___45546 at /home/runner/.julia/compiled/v1.11/CxxWrap/WGIJU_fFeoo.so (unknown line)
...

This is similar to the issue mentioned in my Edit2 block in that PR, caused by a CppFunctionInfo struct getting garbage collected too early, which should be fixed by the second commit.

I believe we haven't experienced anything similar on 1.12-nightly yet (please correct me if I am wrong @benlorenz).

It did happen on nightly as well: https://github.com/oscar-system/Oscar.jl/actions/runs/11347922803/job/31660054773#step:10:336
But less frequently.

Edit: Also seems to happen with 1.6, e.g. here, but very rarely. (This is the first time I have seen this for 1.6)

@lgoettgens
Copy link
Contributor Author

Resolved by JuliaInterop/libcxxwrap-julia#177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants