You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pybind11 crashes when running with asyncio. The issue seems to be related to reference counting function objects, but I haven't been able to get more precise than that.
The following code crashes reliable within the first few iterations on my machine. Unfortunately, the same code runs fine on some other machines, even within the same Docker image.
Thread 2"python3" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff416b700 (LWP 12)]
0x00000000004d610d in ?? ()
(gdb) bt
#00x00000000004d610d in ?? ()
#10x000000000048c311 in ?? ()
#20x00007ffff4e38790 in pybind11::handle::dec_ref() const & (this=0xc8dba0)
at external/pybind11_archive/include/pybind11/pytypes.h:165
#30x00007ffff4e38842 in pybind11::object::~object (this=0xc8dba0,
__in_chrg=<optimized out>)
at external/pybind11_archive/include/pybind11/pytypes.h:208
#40x00007ffff4e3e0c4 in pybind11::function::~function (this=0xc8dba0,
__in_chrg=<optimized out>)
at external/pybind11_archive/include/pybind11/pytypes.h:1226
#50x00007ffff4e522be in pybind11::detail::type_caster<std::function<void (int)>, void>::load(pybind11::handle, bool)::{lambda(int)#1}::~handle() (
this=0xc8dba0, __in_chrg=<optimized out>)
at external/pybind11_archive/include/pybind11/functional.h:57
#60x00007ffff4e5462e in std::_Function_base::_Base_manager<pybind11::detail::type_caster<std::function<void (int)>, void>::load(pybind11::handle, bool)::{lambda(int)#1}>::_M_destroy(std::_Any_data&, std::integral_constant<bool, false>) (
__victim=...) at /usr/include/c++/7/bits/std_function.h:207
#70x00007ffff4e53d65 in std::_Function_base::_Base_manager<pybind11::detail::type_caster<std::function<void (int)>, void>::load(pybind11::handle, bool)::{lambda(int)#1}>::_M_manager(std::_Any_data&, std::_Function_base::_Base_manager<pybind11::detail::type_caster<std::function<void (int)>, void>::load(pybind11::handle, bool)::{lambda(int)#1}> const&, std::_Manager_operation) (__dest=...,
__source=..., __op=std::__destroy_functor)
at /usr/include/c++/7/bits/std_function.h:231
#80x00007ffff4e42407 in std::_Function_base::~_Function_base (this=0xbe7a58,
__in_chrg=<optimized out>) at /usr/include/c++/7/bits/std_function.h:276
#90x00007ffff4e4254a in std::function<void (int)>::~function() (
this=0xbe7a58, __in_chrg=<optimized out>)
at /usr/include/c++/7/bits/std_function.h:389
#100x00007ffff4e36802 in <lambda(std::function<void(int)>)>::<lambda()>::~<lambda>(void) (this=0xbe7a58, __in_chrg=<optimized out>) at test.py.cc:12
#110x00007ffff4e36958 in std::_Head_base<0, pybind11_init_test(pybind11::module&)::<lambda(std::function<void(int)>)>::<lambda()>, false>::~_Head_base(void) (
this=0xbe7a58, __in_chrg=<optimized out>) at /usr/include/c++/7/tuple:120
#120x00007ffff4e36974 in std::_Tuple_impl<0, pybind11_init_test(pybind11::module&)::<lambda(std::function<void(int)>)>::<lambda()> >::~_Tuple_impl(void) (
this=0xbe7a58, __in_chrg=<optimized out>) at /usr/include/c++/7/tuple:343
#130x00007ffff4e36990 in std::tuple<pybind11_init_test(pybind11::module&)::<lambda(std::function<void(int)>)>::<lambda()> >::~tuple(void) (this=0xbe7a58,
__in_chrg=<optimized out>) at /usr/include/c++/7/tuple:556
#140x00007ffff4e369ac in std::thread::_Invoker<std::tuple<pybind11_init_test(pybind11::module&)::<lambda(std::function<void(int)>)>::<lambda()> > >::~_Invoker(void) (this=0xbe7a58, __in_chrg=<optimized out>)
at /usr/include/c++/7/thread:221
#150x00007ffff4e378f8 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<pybind11_init_test(pybind11::module&)::<lambda(std::function<void(int)>)>::<lambda()> > > >::~_State_impl(void) (this=0xbe7a50, __in_chrg=<optimized out>)
at /usr/include/c++/7/thread:178
#160x00007ffff4e37920 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<pybind11_init_test(pybind11::module&)::<lambda(std::function<void(int)>)>::<lambda()> > > >::~_State_impl(void) (this=0xbe7a50, __in_chrg=<optimized out>)
at /usr/include/c++/7/thread:178
#170x00007ffff448273c in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#180x00007ffff7bbd6db in start_thread (arg=0x7ffff416b700)
at pthread_create.c:463
#190x00007ffff6cf288f in clone ()
(Note: This used pybind11 at commit 435dbdd, but fails with other versions as well)
Pybind11 crashes when running with asyncio. The issue seems to be related to reference counting function objects, but I haven't been able to get more precise than that.
The following code crashes reliable within the first few iterations on my machine. Unfortunately, the same code runs fine on some other machines, even within the same Docker image.
C++ code:
Python code:
Stacktrace:
(Note: This used pybind11 at commit 435dbdd, but fails with other versions as well)
Dockerfile:
(Note: this also fails on ubuntu:xenial)
The text was updated successfully, but these errors were encountered: