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

Singular doctests crashing with 1.6 (sometimes) nightly (more or less every time) #641

Closed
benlorenz opened this issue May 3, 2023 · 5 comments
Assignees

Comments

@benlorenz
Copy link
Member

benlorenz commented May 3, 2023

I got this backtrace for the Singular.jl doctests with nightly (after changing one Vector{T} where T to Vector):

Core file '/tmp/jl_Q7SsPU/core_julia.31776_1683130353' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'julia', stop reason = signal SIGSEGV
  * frame #0: 0x00001469c3ebc934 libpolys.so`id_Copy(sip_sideal*, ip_sring*) + 20
    frame #1: 0x00001469e8746391 libsingular_julia.so`std::_Function_handler<ssyStrategy*(void*, long int, ip_sring*), define_julia_module(jlcxx::Module&)::<lambda(void*, int64_t, ring)> >::_M_invoke(const std::_Any_data &, void *&&, long &&, ip_sring *&&) at singular.cpp:338:36
    frame #2: 0x00001469e87462de libsingular_julia.so`std::_Function_handler<ssyStrategy*(void*, long int, ip_sring*), define_julia_module(jlcxx::Module&)::<lambda(void*, int64_t, ring)> >::_M_invoke(__functor=<unavailable>, __args#0=<unavailable>, __args#1=<unavailable>, __args#2=<unavailable>) at std_function.h:282:44
    frame #3: 0x00001469e874d04d libsingular_julia.so`jlcxx::detail::CallFunctor<ssyStrategy*, void*, long, ip_sring*>::apply(void const*, void*, long, jlcxx::WrappedCppPtr) [inlined] jlcxx::detail::ReturnTypeAdapter<ssyStrategy*, void*, long, ip_sring*>::operator(this=<unavailable>, args#2=<unavailable>, args#1=<unavailable>, args#0=<unavailable>, functor=<unavailable>)(void const*, void*, long, jlcxx::WrappedCppPtr) at std_function.h:687:14
    frame #4: 0x00001469e874d025 libsingular_julia.so`jlcxx::detail::CallFunctor<ssyStrategy*, void*, long, ip_sring*>::apply(functor=<unavailable>, args#0=<unavailable>, args#1=<unavailable>, args#2=<unavailable>) at module.hpp:72:45
    frame #5: 0x00001469e3739a9f
    frame #6: 0x00001469e3739cb3
    frame #7: 0x0000146a5b461995 libjulia-internal.so.1`do_call [inlined] jl_apply(nargs=<unavailable>, args=<unavailable>) at julia.h:1886:12
    frame #8: 0x0000146a5b461983 libjulia-internal.so.1`do_call(args=<unavailable>, nargs=<unavailable>, s=<unavailable>) at interpreter.c:125:26
    frame #9: 0x0000146a5b461480 libjulia-internal.so.1`eval_value(e=<unavailable>, s=0x00007ffdaa9710b0) at interpreter.c:222:16
    frame #10: 0x0000146a5b462174 libjulia-internal.so.1`eval_body [inlined] eval_stmt_value(s=0x00007ffdaa9710b0, stmt=<unavailable>) at interpreter.c:173:23
    frame #11: 0x0000146a5b462162 libjulia-internal.so.1`eval_body(stmts=<unavailable>, s=0x00007ffdaa9710b0, ip=1, toplevel=1) at interpreter.c:602:21
    frame #12: 0x0000146a5b462e52 libjulia-internal.so.1`jl_interpret_toplevel_thunk(m=0x00001469de789aa0, src=0x00001469dfbd2190) at interpreter.c:760:21
    frame #13: 0x0000146a5b47ce29 libjulia-internal.so.1`jl_toplevel_eval_flex(m=<unavailable>, e=<unavailable>, fast=<unavailable>, expanded=<unavailable>) at toplevel.c:911:18
    frame #14: 0x0000146a5b47d862 libjulia-internal.so.1`jl_toplevel_eval_flex(m=0x00001469de789aa0, e=0x0000146a51c41170, fast=1, expanded=0) at toplevel.c:854:19
    frame #15: 0x0000146a5b47e93c libjulia-internal.so.1`ijl_toplevel_eval(m=<unavailable>, v=<unavailable>) at toplevel.c:920:12 [artificial]
    frame #16: 0x0000146a5b47ea5b libjulia-internal.so.1`ijl_toplevel_eval_in(m=0x00001469de789aa0, ex=0x0000146a51c41170) at toplevel.c:970:13
    frame #17: 0x0000146a4595e693
    frame #18: 0x0000146a4595e9d0
    frame #19: 0x0000146a47b80d2a sys.so`julia_with_logstate_51427 at logging.jl:515
    frame #20: 0x0000146a4595c057
    frame #21: 0x0000146a4595d5e6
    frame #22: 0x0000146a4595db37
    frame #23: 0x0000146a45944f7b
    frame #24: 0x0000146a4594fb93
    frame #25: 0x0000146a4594fc88
    frame #26: 0x0000146a4594fca7
    frame #27: 0x0000146a4593c1af
    frame #28: 0x0000146a4593f2ca
    frame #29: 0x0000146a4594280a
    frame #30: 0x0000146a45942fc4
    frame #31: 0x0000146a45921fc6
    frame #32: 0x0000146a4592214a
    frame #33: 0x0000146a45926d30
    frame #34: 0x0000146a45926ef8
    frame #35: 0x0000146a45926f23
    frame #36: 0x0000146a4590a539
    frame #37: 0x0000146a4590c924
    frame #38: 0x0000146a4590d0c7
    frame #39: 0x0000146a4590d260
    frame #40: 0x0000146a4590d283
    frame #41: 0x0000146a5b461995 libjulia-internal.so.1`do_call [inlined] jl_apply(nargs=<unavailable>, args=<unavailable>) at julia.h:1886:12
    frame #42: 0x0000146a5b461983 libjulia-internal.so.1`do_call(args=<unavailable>, nargs=<unavailable>, s=<unavailable>) at interpreter.c:125:26
    frame #43: 0x0000146a5b461480 libjulia-internal.so.1`eval_value(e=<unavailable>, s=0x00007ffdaa975f90) at interpreter.c:222:16
    frame #44: 0x0000146a5b462174 libjulia-internal.so.1`eval_body [inlined] eval_stmt_value(s=0x00007ffdaa975f90, stmt=<unavailable>) at interpreter.c:173:23
    frame #45: 0x0000146a5b462162 libjulia-internal.so.1`eval_body(stmts=<unavailable>, s=0x00007ffdaa975f90, ip=0, toplevel=1) at interpreter.c:602:21
    frame #46: 0x0000146a5b462e52 libjulia-internal.so.1`jl_interpret_toplevel_thunk(m=0x0000146a4c6f3cf0, src=0x00001469e0444510) at interpreter.c:760:21
    frame #47: 0x0000146a5b47ce29 libjulia-internal.so.1`jl_toplevel_eval_flex(m=<unavailable>, e=<unavailable>, fast=<unavailable>, expanded=<unavailable>) at toplevel.c:911:18
    frame #48: 0x0000146a5b47d862 libjulia-internal.so.1`jl_toplevel_eval_flex(m=0x0000146a4c6f3cf0, e=<unavailable>, fast=1, expanded=<unavailable>) at toplevel.c:854:19
    frame #49: 0x0000146a5b47d862 libjulia-internal.so.1`jl_toplevel_eval_flex(m=0x0000146a4c6f3cf0, e=0x0000146a5174f1d0, fast=1, expanded=0) at toplevel.c:854:19
    frame #50: 0x0000146a5b47e93c libjulia-internal.so.1`ijl_toplevel_eval(m=<unavailable>, v=<unavailable>) at toplevel.c:920:12 [artificial]
    frame #51: 0x0000146a5b47ea5b libjulia-internal.so.1`ijl_toplevel_eval_in(m=0x0000146a4c6f3cf0, ex=0x0000146a5174f1d0) at toplevel.c:970:13
    frame #52: 0x0000146a47786d22 sys.so`julia_exec_options_57474 at boot.jl:378
    frame #53: 0x0000146a47788311 sys.so`julia__start_57540 at client.jl:541
    frame #54: 0x0000146a47b0c749 sys.so`jfptr__start_57541 + 9
    frame #55: 0x0000146a5b4aadf6 libjulia-internal.so.1`true_main [inlined] jl_apply(nargs=<unavailable>, args=<unavailable>) at julia.h:1886:12
    frame #56: 0x0000146a5b4aadf1 libjulia-internal.so.1`true_main(argc=<unavailable>, argv=<unavailable>) at jlapi.c:577:13
    frame #57: 0x0000146a5b4ab81f libjulia-internal.so.1`jl_repl_entrypoint(argc=<unavailable>, argv=0x00007ffdaa977f18) at jlapi.c:729:15
    frame #58: 0x0000000000400739 julia`main(argc=<unavailable>, argv=<unavailable>) at loader_exe.c:58:15
    frame #59: 0x0000146a5c25024d libc.so.6`__libc_start_main(main=(julia`main at loader_exe.c:36:1), argc=5, argv=0x00007ffdaa977f18, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007ffdaa977f08) at libc-start.c:308

This seems to crash every time on nightly.

With julia 1.6 it took a few tries but way less than for Oscar and I got this crash with the official 1.6.7 julia binary:

(lldb) target create "julia-lts" --core "/tmp/jl_qjRdvv/core_julia-lts.1234_1683130774"
Core file '/tmp/jl_qjRdvv/core_julia-lts.1234_1683130774' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'julia-lts', stop reason = signal SIGSEGV
  * frame #0: 0x00001541112bc934 libpolys.so`id_Copy(sip_sideal*, ip_sring*) + 20
    frame #1: 0x0000154111f463b1 libsingular_julia.so`std::_Function_handler<ssyStrategy*(void*, long int, ip_sring*), define_julia_module(jlcxx::Module&)::<lambda(void*, int64_t, ring)> >::_M_invoke(const std::_Any_data &, void *&&, long &&, ip_sring *&&) at singular.cpp:338:36
    frame #2: 0x0000154111f462fe libsingular_julia.so`std::_Function_handler<ssyStrategy*(void*, long int, ip_sring*), define_julia_module(jlcxx::Module&)::<lambda(void*, int64_t, ring)> >::_M_invoke(__functor=<unavailable>, __args#0=<unavailable>, __args#1=<unavailable>, __args#2=<unavailable>) at std_function.h:282:44
    frame #3: 0x0000154111f4d06d libsingular_julia.so`jlcxx::detail::CallFunctor<ssyStrategy*, void*, long, ip_sring*>::apply(void const*, void*, long, jlcxx::WrappedCppPtr) [inlined] jlcxx::detail::ReturnTypeAdapter<ssyStrategy*, void*, long, ip_sring*>::operator(this=<unavailable>, args#2=<unavailable>, args#1=<unavailable>, args#0=<unavailable>, functor=<unavailable>)(void const*, void*, long, jlcxx::WrappedCppPtr) at std_function.h:687:14
    frame #4: 0x0000154111f4d045 libsingular_julia.so`jlcxx::detail::CallFunctor<ssyStrategy*, void*, long, ip_sring*>::apply(functor=<unavailable>, args#0=<unavailable>, args#1=<unavailable>, args#2=<unavailable>) at module.hpp:72:45
    frame #5: 0x000015414e2a82dd
    frame #6: 0x00001541acd922ba libjulia-internal.so.1`jl_apply_generic at gf.c:2237
    frame #7: 0x00001541acd92279 libjulia-internal.so.1`jl_apply_generic(F=<unavailable>, args=<unavailable>, nargs=<unavailable>) at gf.c:2419
    frame #8: 0x00001541acdaeb56 libjulia-internal.so.1`do_call [inlined] jl_apply(nargs=<unavailable>, args=<unavailable>) at julia.h:1703
    frame #9: 0x00001541acdaeb44 libjulia-internal.so.1`do_call(args=0x00001540f53c19d0, nargs=2, s=0x00007ffd5bdddc80) at interpreter.c:115
    frame #10: 0x00001541acdae80f libjulia-internal.so.1`eval_value(e=<unavailable>, s=0x00007ffd5bdddc80) at interpreter.c:204
    frame #11: 0x00001541acdaf452 libjulia-internal.so.1`eval_body at interpreter.c:155
    frame #12: 0x00001541acdaf440 libjulia-internal.so.1`eval_body(stmts=<unavailable>, s=0x00007ffd5bdddc80, ip=1, toplevel=1) at interpreter.c:562
    frame #13: 0x00001541acdafed8 libjulia-internal.so.1`jl_interpret_toplevel_thunk(m=0x00001540f8bb7a90, src=0x00001540f45c7510) at interpreter.c:670
    frame #14: 0x00001541acdcb7b2 libjulia-internal.so.1`jl_toplevel_eval_flex(m=0x00001540f8bb7a90, e=<unavailable>, fast=1, expanded=<unavailable>) at toplevel.c:877
    frame #15: 0x00001541acdcb9fd libjulia-internal.so.1`jl_toplevel_eval_flex(m=0x00001540f8bb7a90, e=<unavailable>, fast=1, expanded=<unavailable>) at toplevel.c:825
    frame #16: 0x00001541acdcd5ca libjulia-internal.so.1`jl_toplevel_eval_in(m=0x00001540f8bb7a90, ex=0x00001540f3f9fdf0) at toplevel.c:929
    frame #17: 0x000015414ecafb25
    frame #18: 0x000015414ecb005d
    frame #19: 0x000015419e81c880 sys.so`japi1_with_logstate_39508 at logging.jl:491
    frame #20: 0x000015414ecaf471
    frame #21: 0x000015414ecaf64f
    frame #22: 0x000015414ecadc26
    frame #23: 0x000015414ec97638
    frame #24: 0x000015414eca2208
    frame #25: 0x00001541acd922ba libjulia-internal.so.1`jl_apply_generic at gf.c:2237
    frame #26: 0x00001541acd92279 libjulia-internal.so.1`jl_apply_generic(F=<unavailable>, args=<unavailable>, nargs=<unavailable>) at gf.c:2419
    frame #27: 0x000015414ec95757

I ran this with:

julia --color=yes --project=. -e 'using Documenter; using Singular; DocMeta.setdocmeta!(Singular, :DocTestSetup, :(using Singular); recursive = true); doctest(Singular)'

Standard output is just:

[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
Segmentation fault (core dumped)

Originally posted by @benlorenz in oscar-system/Oscar.jl#2336 (comment)

@thofma
Copy link
Collaborator

thofma commented May 5, 2023

It is docs/src/resolution.md:58-81:

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Singular Polynomial Ring (QQ),(x,y),(dp(2),C), spoly{n_Q}[x, y])

julia> M1 = Singular.Module(R, vector(R, x), vector(R, y))
Singular Module over Singular Polynomial Ring (QQ),(x,y),(dp(2),C), with Generators:
x*gen(1)
y*gen(1)

julia> M2 = Singular.Module(R, vector(R, y, -x))
Singular Module over Singular Polynomial Ring (QQ),(x,y),(dp(2),C), with Generators:
-x*gen(2)+y*gen(1)

julia> F = Resolution([M1, M2]);

julia> F[1]
Singular Module over Singular Polynomial Ring (QQ),(x,y),(dp(2),C), with Generators:
x*gen(1)
y*gen(1)

julia> F[2]
Singular Module over Singular Polynomial Ring (QQ),(x,y),(dp(2),C), with Generators:
-x*gen(2)+y*gen(1)

leads to

[78756] signal (11.2): Segmentation fault: 11
in expression starting at REPL[5]:1
_Z7id_CopyP10sip_sidealP8ip_sring at /blabla/artifacts/5338060aba2cf989b4d4f4be04e14af7c99d9230/lib/libpolys-4.3.2.dylib (unknown line)
Allocations: 3383214 (Pool: 3380857; Big: 2357); GC: 6

@benlorenz
Copy link
Member Author

More precisely, with the code from above (on the second try) on julia 1.8.5:

#0  0x00007fbc9daefc39 in p_Copy__FieldQ_LengthThree_OrdGeneral(spolyrec*, ip_sring*) () from /home/lorenz/.julia/artifacts/3a0aef8dcd97ea92b7d254a43b2f0ae8a69f8e42/lib/libpolys.so
#1  0x00007fbc9dabc987 in id_Copy(sip_sideal*, ip_sring*) () from /home/lorenz/.julia/artifacts/3a0aef8dcd97ea92b7d254a43b2f0ae8a69f8e42/lib/libpolys.so
#2  0x00007fbd153463a1 in <lambda(void*, int64_t, ring)>::operator() (__closure=<optimized out>, r=0x1c0e160, len=<optimized out>, res_void=<optimized out>)
    at /workspace/srcdir/libsingular-julia/singular.cpp:338
#3  std::_Function_handler<ssyStrategy*(void*, long int, ip_sring*), define_julia_module(jlcxx::Module&)::<lambda(void*, int64_t, ring)> >::_M_invoke(const std::_Any_data &, void *&&, long &&, ip_sring *&&) (
    __functor=..., __args#0=<optimized out>, __args#1=<optimized out>, __args#2=<optimized out>) at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/std_function.h:282
#4  0x00007fbd1534d05d in std::function<ssyStrategy* (void*, long, ip_sring*)>::operator()(void*, long, ip_sring*) const (__args#2=<optimized out>, __args#1=<optimized out>, __args#0=<optimized out>, 
    this=<optimized out>) at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/std_function.h:687
#5  jlcxx::detail::ReturnTypeAdapter<ssyStrategy*, void*, long, ip_sring*>::operator() (this=<optimized out>, args#2=..., args#1=<optimized out>, args#0=<optimized out>, functor=<optimized out>)
    at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/jlcxx/module.hpp:47
#6  jlcxx::detail::CallFunctor<ssyStrategy*, void*, long, ip_sring*>::apply (functor=<optimized out>, args#0=<optimized out>, args#1=<optimized out>, args#2=...)
    at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/jlcxx/module.hpp:72

@fingolfin
Copy link
Member

I just asked @hannes14 to have a look at this

@fingolfin
Copy link
Member

I can't reproduce any crashes anymore and haven't seen any in a while in the CI (though I may very well have missed them...?). Should we close this?

@benlorenz
Copy link
Member Author

We are not running the doctests with nightly in the CI, but I cannot reproduce this locally with julia nightly.

Maybe this was related to #715 and fixed by #719.

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

4 participants