Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PythonAPI: Fix segfault in GetAvailableMaps
When using CARLA with Python 3.10, I'm getting a segfault in GetAvailableMaps. The problem disappears when PyList manipulation does not happen with GIL unlocked, as done in this commit. The initial part of crash backtrace (from GDB) is below: Program terminated with signal SIGSEGV, Segmentation fault. warning: Section `.reg-xstate/49253' in core file too small. #0 _PyInterpreterState_GET () at ./Include/internal/pycore_pystate.h:117 117 return tstate->interp; [Current thread is 1 (Thread 0x7fe6fe48f740 (LWP 49253))] (gdb) bt #0 _PyInterpreterState_GET () at ./Include/internal/pycore_pystate.h:117 matejm42#1 get_list_state () at Objects/listobject.c:26 carla-simulator#2 PyList_New (size=0) at Objects/listobject.c:159 carla-simulator#3 0x00007fe6fdc0dab0 in boost::python::detail::list_base::list_base() () from /nix/store/c95f3nrkz3sflvycihyw1c8q4nk47p4m-boost-1.79.0/lib/libboost_python310.so.1.79.0 carla-simulator#4 0x00007fe6ef9ecfc4 in boost::python::list::list (this=0x7ffd8a8aae28) at include/boost/python/list.hpp:61 carla-simulator#5 GetAvailableMaps (self=...) at source/libcarla/Client.cpp:26 carla-simulator#6 0x00007fe6efb6a8fe in boost::python::detail::invoke<boost::python::to_python_value<boost::python::list const&>, boost::python::list (*)(carla::client::Client const&), boost::python::arg_from_python<carla::client::Client const&> > (rc=..., f=<optimized out>, ac0=...) at include/boost/python/detail/invoke.hpp:73 carla-simulator#7 boost::python::detail::caller_arity<1u>::impl<boost::python::list (*)(carla::client::Client const&), boost::python::default_call_policies, boost::mpl::vector2<boost::python::list, carla::client::Client const&> >::operator() (args_=<optimized out>, this=<optimized out>) at include/boost/python/detail/caller.hpp:233 carla-simulator#8 boost::python::objects::caller_py_function_impl<boost::python::detail::caller<boost::python::list (*)(carla::client::Client const&), boost::python::default_call_policies, boost::mpl::vector2<boost::python::list, carla::client::Client const&> > >::operator() ( this=<optimized out>, args=<optimized out>, kw=<optimized out>) at include/boost/python/object/py_function.hpp:38 carla-simulator#9 0x00007fe6fdc1b4dd in boost::python::objects::function::call(_object*, _object*) const () from /nix/store/c95f3nrkz3sflvycihyw1c8q4nk47p4m-boost-1.79.0/lib/libboost_python310.so.1.79.0 carla-simulator#10 0x00007fe6fdc1b6a8 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::detail::function::function_buffer&) () from /nix/store/c95f3nrkz3sflvycihyw1c8q4nk47p4m-boost-1.79.0/lib/libboost_python310.so.1.79.0 ...
- Loading branch information