This repository was archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
This repository was archived by the owner on Nov 5, 2023. It is now read-only.
SIGSEGV on exit #52
Copy link
Copy link
Closed
Description
Currently we release the GIL when calling CS_Shutdown, and sometimes this happens:
(gdb) bt
#0 0x00007ffff7d14232 in () at /lib64/libpython3.7m.so.1.0
#1 0x00007ffff7da637e in () at /lib64/libpython3.7m.so.1.0
#2 0x00007fffea629237 in std::_Function_base::_Base_manager<pybind11::detail::type_caster<std::function<void (cs::VideoEvent const&)>, void>::load(pybind11::handle, bool)::{lambda(cs::VideoEvent const&)#1}>::_M_manager(std::_Any_data&, std::_Function_base::_Base_manager<pybind11::detail::type_caster<std::function<void (cs::VideoEvent const&)>, void>::load(pybind11::handle, bool)::{lambda(cs::VideoEvent const&)#1}> const&, std::_Manager_operation) (__dest=..., __source=..., __op=4294967293)
at /mnt/sdb1/virtuald_dot/virtualenvs/frc/include/site/python3.7/pybind11/pytypes.h:165
#3 0x00007fffea61cd0c in std::_Function_base::_Base_manager<cs::VideoListener::VideoListener(std::function<void (cs::VideoEvent const&)>, int, bool)::{lambda(cs::RawEvent const&)#1}>::_M_manager(std::_Any_data&, std::_Function_base::_Base_manager<cs::VideoListener::VideoListener(std::function<void (cs::VideoEvent const&)>, int, bool)::{lambda(cs::RawEvent const&)#1}> const&, std::_Manager_operation)
(__dest=..., __source=..., __op=4294967293) at /usr/include/c++/8/bits/std_function.h:257
#4 0x00007fffea630287 in cs::Notifier::Thread::__dt_base() () at /usr/include/c++/8/bits/std_function.h:257
#5 0x00007fffea627957 in std::_Sp_counted_base::_M_release (this=0x7fffd8115f60)
at /usr/include/c++/8/bits/shared_ptr_base.h:155
#6 0x00007fffea627957 in std::_Sp_counted_base::_M_release() (this=0x7fffd8115f60)
at /usr/include/c++/8/bits/shared_ptr_base.h:148
#7 0x00007fffea641d6d in wpi::detail::SafeThreadOwnerBase::Stop() (this=0x555555a254f8)
at /usr/include/c++/8/bits/shared_ptr_base.h:706
#8 0x00007fffea6b5bde in __lambda78::_FUN(void*) ()
at cscore_src/cscore/src/main/native/cpp/Notifier.cpp:100
#9 0x00007ffff7cf5414 in () at /lib64/libpython3.7m.so.1.0
#10 0x00007ffff7d13f1f in () at /lib64/libpython3.7m.so.1.0
#11 0x00007ffff7da6770 in () at /lib64/libpython3.7m.so.1.0
#12 0x00007ffff7d6cd67 in PyDict_SetItem () at /lib64/libpython3.7m.so.1.0
#13 0x00007ffff7daa50e in _PyModule_ClearDict () at /lib64/libpython3.7m.so.1.0
#14 0x00007ffff7df0d09 in PyImport_Cleanup () at /lib64/libpython3.7m.so.1.0
#15 0x00007ffff7e57f68 in Py_FinalizeEx () at /lib64/libpython3.7m.so.1.0
#16 0x00007ffff7e5a604 in () at /lib64/libpython3.7m.so.1.0
#17 0x00007ffff7e5abdc in _Py_UnixMain () at /lib64/libpython3.7m.so.1.0
#18 0x00007ffff78c8413 in __libc_start_main () at /lib64/libc.so.6
#19 0x000055555555508e in _start ()
The error is on a Py_XDECREF, so that's probably related to releasing the GIL?
I release the GIL, and it seems that pybind11 has wound itself up into the std::function pointers, so cscore would need to clear them on exit.
(gdb) bt
#0 0x00007ffff7d14232 in () at /lib64/libpython3.7m.so.1.0
#1 0x00007ffff7da637e in () at /lib64/libpython3.7m.so.1.0
#2 0x00007fffea629087 in std::_Function_base::_Base_manager<pybind11::detail::type_caster<std::function<void (cs::VideoEvent const&)>, void>::load(pybind11::handle, bool)::{lambda(cs::VideoEvent const&)#1}>::_M_manager(std::_Any_data&, std::_Function_base::_Base_manager<pybind11::detail::type_caster<std::function<void (cs::VideoEvent const&)>, void>::load(pybind11::handle, bool)::{lambda(cs::VideoEvent const&)#1}> const&, std::_Manager_operation) (__dest=..., __source=..., __op=4294967293)
at /mnt/sdb1/virtuald_dot/virtualenvs/frc/include/site/python3.7/pybind11/pytypes.h:165
#3 0x00007fffea61ccbc in std::_Function_base::_Base_manager<cs::VideoListener::VideoListener(std::function<void (cs::VideoEvent const&)>, int, bool)::{lambda(cs::RawEvent const&)#1}>::_M_manager(std::_Any_data&, std::_Function_base::_Base_manager<cs::VideoListener::VideoListener(std::function<void (cs::VideoEvent const&)>, int, bool)::{lambda(cs::RawEvent const&)#1}> const&, std::_Manager_operation)
(__dest=..., __source=..., __op=4294967293) at /usr/include/c++/8/bits/std_function.h:257
#4 0x00007fffea630277 in cs::Notifier::Thread::__dt_base() () at /usr/include/c++/8/bits/std_function.h:257
#5 0x00007fffea63dd88 in std::thread::_State_impl::__dt_base ()
at /usr/include/c++/8/bits/shared_ptr_base.h:155
#6 0x00007fffea63dd88 in std::thread::_State_impl::__dt_del() () at /usr/include/c++/8/thread:188
#7 0x00007fffe60e694c in () at /lib64/libstdc++.so.6
#8 0x00007ffff7c0158e in start_thread () at /lib64/libpthread.so.0
#9 0x00007ffff79a16a3 in clone () at /lib64/libc.so.6
Metadata
Metadata
Assignees
Labels
No labels