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
For more context i was implementing the dbus api of libgpiod and one of the objects has a "release" method that releases some gpio lines and effectively kills the dbus object for them as well.
When trying to suicide the objects there seems to be some usage of them in the event loop that causes issues after exiting the callback for the release method.
Here is the output from valgrind in case i am misreading it.
==2130== Invalid read of size 8
==2130== at 0x5052A70: ??? (in /usr/lib/libsystemd.so.0.40.0)
==2130== by 0x5048D43: ??? (in /usr/lib/libsystemd.so.0.40.0)
==2130== by 0x504B4EE: ??? (in /usr/lib/libsystemd.so.0.40.0)
==2130== by 0x4FF09EF: ??? (in /usr/lib/libsystemd.so.0.40.0)
==2130== by 0x4FF1008: sd_bus_slot_unref (in /usr/lib/libsystemd.so.0.40.0)
==2130== by 0x4FEA9CF: ??? (in /usr/lib/libsystemd.so.0.40.0)
==2130== by 0x4FFE200: ??? (in /usr/lib/libsystemd.so.0.40.0)
==2130== by 0x4985E70: UnknownInlinedFun (SdBus.cpp:380)
==2130== by 0x4985E70: sdbus::internal::Connection::processPendingEvent() (Connection.cpp:789)
==2130== by 0x4987AC8: sdbus::internal::Connection::enterEventLoop() (Connection.cpp:147)
==2130== by 0x400D28A: main (src/main.cpp:45)
==2130== Address 0x513ccda is 154 bytes inside a block of size 272 free'd
==2130== at 0x49148DD: operator delete(void*, unsigned long) (vg_replace_malloc.c:1181)
==2130== by 0x498A65E: UnknownInlinedFun (new_allocator.h:172)
==2130== by 0x498A65E: UnknownInlinedFun (allocator.h:208)
==2130== by 0x498A65E: UnknownInlinedFun (alloc_traits.h:513)
==2130== by 0x498A65E: UnknownInlinedFun (stl_vector.h:389)
==2130== by 0x498A65E: UnknownInlinedFun (stl_vector.h:368)
==2130== by 0x498A65E: UnknownInlinedFun (stl_vector.h:738)
==2130== by 0x498A65E: sdbus::internal::Object::VTable::~VTable() (Object.h:79)
==2130== by 0x498A7EC: UnknownInlinedFun (Object.cpp:77)
==2130== by 0x498A7EC: UnknownInlinedFun (invoke.h:61)
==2130== by 0x498A7EC: UnknownInlinedFun (invoke.h:111)
==2130== by 0x498A7EC: std::_Function_handler<void (void*), sdbus::internal::Object::addVTable(sdbus::InterfaceName, std::vector<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem>, std::allocator<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem> > >, sdbus::return_slot_t)::{lambda(void*)#1}>::_M_invoke(std::_Any_data const&, void*&&) (std_function.h:290)
==2130== by 0x4989742: UnknownInlinedFun (std_function.h:591)
==2130== by 0x4989742: UnknownInlinedFun (unique_ptr.h:398)
==2130== by 0x4989742: UnknownInlinedFun (stl_construct.h:88)
==2130== by 0x4989742: UnknownInlinedFun (stl_construct.h:149)
==2130== by 0x4989742: UnknownInlinedFun (stl_construct.h:163)
==2130== by 0x4989742: UnknownInlinedFun (stl_construct.h:196)
==2130== by 0x4989742: UnknownInlinedFun (alloc_traits.h:944)
==2130== by 0x4989742: UnknownInlinedFun (stl_vector.h:1947)
==2130== by 0x4989742: UnknownInlinedFun (stl_vector.h:1608)
==2130== by 0x4989742: sdbus::internal::Object::unregister() (Object.cpp:82)
==2130== by 0x4078761: sdbus::AdaptorInterfaces<io::gpiod1::Request_adaptor>::unregisterAdaptor() (AdaptorInterfaces.h:132)
==2130== by 0x4077EA1: dbus_request::~dbus_request() (src/dbus_request.cpp:29)
==2130== by 0x405A46C: std::pair<sdbus::ObjectPath const, dbus_request>::~pair() (stl_iterator.h:3106)
==2130== by 0x405A444: void std::destroy_at<std::pair<sdbus::ObjectPath const, dbus_request> >(std::pair<sdbus::ObjectPath const, dbus_request>*) (stl_construct.h:88)
==2130== by 0x405A37A: destroy<std::pair<const sdbus::ObjectPath, dbus_request> > (alloc_traits.h:698)
==2130== by 0x405A37A: std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<sdbus::ObjectPath const, dbus_request>, true> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<sdbus::ObjectPath const, dbus_request>, true>*) (hashtable_policy.h:1572)
==2130== by 0x406C0B2: std::_Hashtable<sdbus::ObjectPath, std::pair<sdbus::ObjectPath const, dbus_request>, std::allocator<std::pair<sdbus::ObjectPath const, dbus_request> >, std::__detail::_Select1st, std::equal_to<sdbus::ObjectPath>, std::hash<sdbus::ObjectPath>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_erase(unsigned long, std::__detail::_Hash_node_base*, std::__detail::_Hash_node<std::pair<sdbus::ObjectPath const, dbus_request>, true>*) (hashtable.h:2590)
==2130== by 0x406BD96: std::_Hashtable<sdbus::ObjectPath, std::pair<sdbus::ObjectPath const, dbus_request>, std::allocator<std::pair<sdbus::ObjectPath const, dbus_request> >, std::__detail::_Select1st, std::equal_to<sdbus::ObjectPath>, std::hash<sdbus::ObjectPath>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::erase(sdbus::ObjectPath const&) (hashtable.h:2620)
==2130== by 0x4058ADC: std::unordered_map<sdbus::ObjectPath, dbus_request, std::hash<sdbus::ObjectPath>, std::equal_to<sdbus::ObjectPath>, std::allocator<std::pair<sdbus::ObjectPath const, dbus_request> > >::erase(sdbus::ObjectPath const&) (unordered_map.h:834)
==2130== Block was alloc'd at
==2130== at 0x4910F93: operator new(unsigned long) (vg_replace_malloc.c:487)
==2130== by 0x49952BC: UnknownInlinedFun (new_allocator.h:151)
==2130== by 0x49952BC: UnknownInlinedFun (allocator.h:196)
==2130== by 0x49952BC: UnknownInlinedFun (alloc_traits.h:478)
==2130== by 0x49952BC: UnknownInlinedFun (stl_vector.h:380)
==2130== by 0x49952BC: UnknownInlinedFun (vector.tcc:596)
==2130== by 0x49952BC: UnknownInlinedFun (vector.tcc:123)
==2130== by 0x49952BC: UnknownInlinedFun (stl_vector.h:1301)
==2130== by 0x49952BC: sdbus::internal::Object::writePropertyRecordToVTable(sdbus::PropertyVTableItem, sdbus::internal::Object::VTable&) (Object.cpp:226)
==2130== by 0x499600D: UnknownInlinedFun (Object.cpp:179)
==2130== by 0x499600D: UnknownInlinedFun (invoke.h:61)
==2130== by 0x499600D: UnknownInlinedFun (invoke.h:96)
==2130== by 0x499600D: UnknownInlinedFun (variant:1060)
==2130== by 0x499600D: UnknownInlinedFun (variant:1821)
==2130== by 0x499600D: UnknownInlinedFun (variant:1882)
==2130== by 0x499600D: sdbus::internal::Object::createInternalVTable(sdbus::InterfaceName, std::vector<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem>, std::allocator<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem> > >) (Object.cpp:176)
==2130== by 0x4996162: sdbus::internal::Object::addVTable(sdbus::InterfaceName, std::vector<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem>, std::allocator<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem> > >, sdbus::return_slot_t) (Object.cpp:64)
==2130== by 0x49966CC: sdbus::internal::Object::addVTable(sdbus::InterfaceName, std::vector<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem>, std::allocator<std::variant<sdbus::MethodVTableItem, sdbus::SignalVTableItem, sdbus::PropertyVTableItem, sdbus::InterfaceFlagsVTableItem> > >) (Object.cpp:54)
==2130== by 0x406BC08: sdbus::VTableAdder::forInterface(sdbus::InterfaceName) (ConvenienceApiClasses.inl:58)
==2130== by 0x405EE60: sdbus::VTableAdder::forInterface(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (ConvenienceApiClasses.inl:63)
==2130== by 0x407AE38: io::gpiod1::Request_adaptor::registerAdaptor() (include/sdbus-glue/gpio_manager_server_glue.hpp:157)
==2130== by 0x4078714: sdbus::AdaptorInterfaces<io::gpiod1::Request_adaptor>::registerAdaptor() (AdaptorInterfaces.h:120)
==2130== by 0x4077D6C: dbus_request::dbus_request(std::span<std::reference_wrapper<dbus_line>, 18446744073709551615ul>, dbus_chip&, sdbus::IConnection&, sdbus::ObjectPath) (src/dbus_request.cpp:20)
==2130== by 0x406EA80: std::pair<sdbus::ObjectPath const, dbus_request>::pair<sdbus::ObjectPath&&, 0ul, std::vector<std::reference_wrapper<dbus_line>, std::allocator<std::reference_wrapper<dbus_line> > >&, dbus_chip&, sdbus::IConnection&, sdbus::ObjectPath&&, 0ul, 1ul, 2ul, 3ul>(std::tuple<sdbus::ObjectPath&&>&, std::tuple<std::vector<std::reference_wrapper<dbus_line>, std::allocator<std::reference_wrapper<dbus_line> > >&, dbus_chip&, sdbus::IConnection&, sdbus::ObjectPath&&>&, std::_Index_tuple<0ul>, std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) (tuple:2887)
==2130== by 0x406E8AC: std::pair<sdbus::ObjectPath const, dbus_request>::pair<sdbus::ObjectPath&&, std::vector<std::reference_wrapper<dbus_line>, std::allocator<std::reference_wrapper<dbus_line> > >&, dbus_chip&, sdbus::IConnection&, sdbus::ObjectPath&&>(std::piecewise_construct_t, std::tuple<sdbus::ObjectPath&&>, std::tuple<std::vector<std::reference_wrapper<dbus_line>, std::allocator<std::reference_wrapper<dbus_line> > >&, dbus_chip&, sdbus::IConnection&, sdbus::ObjectPath&&>) (tuple:2874)
My assumption from reading the code a bit seems that there is not much that can be done about this. So let me know if there are solutions to this
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to do that?
For more context i was implementing the dbus api of libgpiod and one of the objects has a "release" method that releases some gpio lines and effectively kills the dbus object for them as well.
When trying to suicide the objects there seems to be some usage of them in the event loop that causes issues after exiting the callback for the release method.
Here is the output from valgrind in case i am misreading it.
My assumption from reading the code a bit seems that there is not much that can be done about this. So let me know if there are solutions to this
Beta Was this translation helpful? Give feedback.
All reactions