Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Rare segfault on termination #81

Open
tmplt opened this issue Apr 19, 2019 · 0 comments
Open

Rare segfault on termination #81

tmplt opened this issue Apr 19, 2019 · 0 comments
Labels
bug core this issue regards the bookwyrm core python

Comments

@tmplt
Copy link
Owner

tmplt commented Apr 19, 2019

A rare race condition is encountered with Python threads upon termination:

Python thread backtrace (segfault)
#0  0x00007f62af378be0 in raise () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libc.so.6
#0  0x00007f62af378be0 in raise () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libc.so.6
#1  0x00007f62af379dc1 in abort () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libc.so.6
#2  0x00007f62af3ba2ac in __libc_message () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libc.so.6
#3  0x00007f62af3ba2ce in __libc_fatal () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libc.so.6
#4  0x00007f62af708630 in unwind_cleanup () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libpthread.so.0
#5  0x00007f62a4e530d8 in pybind11::cpp_function::dispatcher (self=0x7f62a53cc0c0, args_in=0x7f62a05ef3c8, kwargs_in=0x0)
    at /home/tmplt/code/bookwyrm/lib/pybind11/include/pybind11/pybind11.h:666
#6  0x00007f62b07ad8ba in _PyCFunction_FastCallDict () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#7  0x00007f62b083bb99 in call_function () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#8  0x00007f62b0840ef1 in _PyEval_EvalFrameDefault () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#9  0x00007f62b083c039 in call_function () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#10 0x00007f62b0840ef1 in _PyEval_EvalFrameDefault () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#11 0x00007f62b083c039 in call_function () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#12 0x00007f62b0840ef1 in _PyEval_EvalFrameDefault () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#13 0x00007f62b083c039 in call_function () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#14 0x00007f62b0840ef1 in _PyEval_EvalFrameDefault () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#15 0x00007f62b083ba3a in _PyEval_EvalCodeWithName () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#16 0x00007f62b083c09e in PyEval_EvalCodeEx () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#17 0x00007f62b0776475 in function_call () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#18 0x00007f62b0743158 in PyObject_Call () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#19 0x00000000004b6bca in bookwyrm::core::plugin_handler::python_module_runner (this=0x14b8d80, module=...)
    at /home/tmplt/code/bookwyrm/src/core/plugin_handler.cpp:186
#20 0x00000000004c4c77 in std::__invoke_impl<void, void (bookwyrm::core::plugin_handler::*)(pybind11::module), bookwyrm::core::plugin_handler*, pybind11::module> (__f=
    @0x1b63848: (void (bookwyrm::core::plugin_handler::*)(bookwyrm::core::plugin_handler * const, pybind11::module)) 0x4b6a0e <bookwyrm::core::plugin_handler::python_module_runner(pybind11::module)>, __t=@0x1b63840: 0x14b8d80, __args#0=...)
    at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/invoke.h:73
#21 0x00000000004c35f9 in std::__invoke<void (bookwyrm::core::plugin_handler::*)(pybind11::module), bookwyrm::core::plugin_handler*, pybind11::module> (
    __fn=
    @0x1b63848: (void (bookwyrm::core::plugin_handler::*)(bookwyrm::core::plugin_handler * const, pybind11::module)) 0x4b6a0e <bookwyrm::core::plugin_handler::python_module_runner(pybind11::module)>, __args#0=@0x1b63840: 0x14b8d80, __args#1=...)
    at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/invoke.h:95
#22 0x00000000004c670d in std::thread::_Invoker<std::tuple<void (bookwyrm::core::plugin_handler::*)(pybind11::module), bookwyrm::core::plugin_handler*, pybind11::module> >::_M_invoke<0ul, 1ul, 2ul> (this=0x1b63838) at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/thread:234
#23 0x00000000004c66a7 in std::thread::_Invoker<std::tuple<void (bookwyrm::core::plugin_handler::*)(pybind11::module), bookwyrm::core::plugin_handler*, pybind11::module> >::operator() (this=0x1b63838) at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/thread:243
#24 0x00000000004c6686 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (bookwyrm::core::plugin_handler::*)(pybind11::module), bookwyrm::core::plugin_handler*, pybind11::module> > >::_M_run (this=0x1b63830) at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/thread:186
#25 0x00007f62aff83edf in ?? () from /nix/store/zk5zj2307zxaq7dx585yia3dn5k4qlsl-gcc-7.3.0-lib/lib/libstdc++.so.6
#26 0x00007f62af6ff5a7 in start_thread () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libpthread.so.0
#27 0x00007f62af43622f in clone () from /nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libc.so.6
Main thread backtrace
#0  0x00007f62b085d63c in PyImport_Cleanup () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#0  0x00007f62b085d63c in PyImport_Cleanup () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#1  0x00007f62b086d480 in Py_FinalizeEx () from /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/libpython3.6m.so.1.0
#2  0x00000000004ba08e in pybind11::finalize_interpreter () at /home/tmplt/code/bookwyrm/lib/pybind11/include/pybind11/embed.h:159
#3  0x00000000004ba192 in pybind11::scoped_interpreter::~scoped_interpreter (this=0x14b8fd0, __in_chrg=<optimized out>)
    at /home/tmplt/code/bookwyrm/lib/pybind11/include/pybind11/embed.h:193
#4  0x00000000004b65a4 in bookwyrm::core::plugin_handler::~plugin_handler (this=0x14b8d80, __in_chrg=<optimized out>)
    at /home/tmplt/code/bookwyrm/src/core/plugin_handler.cpp:114
#5  0x000000000045bc19 in __gnu_cxx::new_allocator<bookwyrm::core::plugin_handler>::destroy<bookwyrm::core::plugin_handler> (this=0x14b8d80, 
    __p=0x14b8d80) at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/ext/new_allocator.h:140
#6  0x000000000045bb5b in std::allocator_traits<std::allocator<bookwyrm::core::plugin_handler> >::destroy<bookwyrm::core::plugin_handler> (__a=..., 
    __p=0x14b8d80) at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/alloc_traits.h:487
#7  0x000000000045b913 in std::_Sp_counted_ptr_inplace<bookwyrm::core::plugin_handler, std::allocator<bookwyrm::core::plugin_handler>, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x14b8d70) at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/shared_ptr_base.h:535
#8  0x0000000000426c8e in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x14b8d70)
    at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/shared_ptr_base.h:154
#9  0x0000000000420d71 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x7ffc4d9f9758, __in_chrg=<optimized out>)
    at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/shared_ptr_base.h:684
#10 0x000000000041f3a8 in std::__shared_ptr<bookwyrm::core::plugin_handler, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7ffc4d9f9750, 
    __in_chrg=<optimized out>) at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/shared_ptr_base.h:1123
#11 0x000000000041f3c4 in std::shared_ptr<bookwyrm::core::plugin_handler>::~shared_ptr (this=0x7ffc4d9f9750, __in_chrg=<optimized out>)
    at /nix/store/vv4r320p5yd1k01kld62q1lppjxcswhb-gcc-7.3.0/include/c++/7.3.0/bits/shared_ptr.h:93
#12 0x0000000000410de0 in main (argc=3, argv=0x7ffc4d9f9ee8) at /home/tmplt/code/bookwyrm/src/main.cpp:220

@tmplt tmplt added bug python core this issue regards the bookwyrm core labels Apr 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug core this issue regards the bookwyrm core python
Projects
None yet
Development

No branches or pull requests

1 participant