Skip to content

Conversation

@pierrewillenbrockdfki
Copy link
Contributor

Take 2: fixed the memory leak fix crash, dropped the build system stuff for now.

The build system stuff needs changes elsewhere(base/cmake currently breaking knowledge_reasoning/gqr) to work right.

@pierrewillenbrockdfki pierrewillenbrockdfki changed the title Various fixes pierre 202601 Set of various fixes Jan 16, 2026
@pierrewillenbrockdfki
Copy link
Contributor Author

@skasperski this probably does no longer crash rock-runtime.

@pierrewillenbrockdfki pierrewillenbrockdfki marked this pull request as draft January 16, 2026 14:51
@skasperski
Copy link
Contributor

====================================================
                  rock-runtime
----------------------------------------------------

Initializing ROCK...                            [OK]    
Initializing process server local...            [OK]    

Starting process servers:
  process_server_local                          free(): double free detected in tcache 2
Stack trace (most recent call last):
#15   Object "/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2", at 0xffffffffffffffff, in 
#14   Object "/home/dfki.uni-bremen.de/skasperski/Robotics/rock-local/install/bin/rock-runtime", at 0x62c8a3570e54, in _start
#13   Source "../csu/libc-start.c", line 360, in __libc_start_main_impl [0x717d1722a28a]
#12   Source "../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main [0x717d1722a1c9]
#11   Object "/home/dfki.uni-bremen.de/skasperski/Robotics/rock-local/install/bin/rock-runtime", at 0x62c8a356fe93, in main
#10   Object "/home/dfki.uni-bremen.de/skasperski/Robotics/rock-local/install/lib/liborocos_cpp.so", at 0x717d1836c97b, in orocos_cpp::ConfigurationHelper::applyConfToProperty(RTT::TaskContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, libConfig::ConfigValue const&)
#9    Object "/home/dfki.uni-bremen.de/skasperski/Robotics/rock-local/install/lib/liborocos_cpp.so", at 0x717d1836c83d, in orocos_cpp::ConfigurationHelper::applyConfigValueOnDSB(boost::intrusive_ptr<RTT::base::DataSourceBase>, RTT::types::TypeInfo const*, libConfig::ConfigValue const&)
#8    Object "/home/dfki.uni-bremen.de/skasperski/Robotics/rock-local/install/lib/librtt-typelib-gnulinux.so", at 0x717d17e07df2, in orogen_transports::TypelibMarshallerBase::deleteHandle(orogen_transports::TypelibMarshallerBase::Handle*)
#7    Object "/home/dfki.uni-bremen.de/skasperski/Robotics/rock-local/install/lib/orocos/types/libstd-transport-typelib-gnulinux.so", at 0x717d1476d11f, in orogen_transports::TypelibMarshaller<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::deleteTypelibSample(orogen_transports::TypelibMarshallerBase::Handle*)
#6    Source "./malloc/malloc.c", line 3398, in __libc_free [0x717d172addad]
#5    Source "./malloc/malloc.c", line 4541, in _int_free [0x717d172ab55e]
#4    Source "./malloc/malloc.c", line 5772, in malloc_printerr [0x717d172a8ff4]
#3    Source "../sysdeps/posix/libc_fatal.c", line 134, in __libc_message_impl [0x717d172297b5]
#2    Source "./stdlib/abort.c", line 79, in abort [0x717d172288fe]
#1    Source "../sysdeps/posix/raise.c", line 26, in raise [0x717d1724527d]
#0  | Source "./nptl/pthread_kill.c", line 89, in __pthread_kill_internal
    | Source "./nptl/pthread_kill.c", line 78, in __pthread_kill_implementation
      Source "./nptl/pthread_kill.c", line 44, in __pthread_kill [0x717d1729eb2c]
Aborted (Signal sent by tkill() 19194 1545606974)
Aborted (core dumped)

@pierrewillenbrockdfki pierrewillenbrockdfki force-pushed the various-fixes-pierre-202601 branch from 9bd9ce8 to 7c9b730 Compare January 19, 2026 15:13
instead of indexing into the const char * literal
@pierrewillenbrockdfki pierrewillenbrockdfki force-pushed the various-fixes-pierre-202601 branch from 3f59b25 to 374d135 Compare January 19, 2026 15:16
@pierrewillenbrockdfki
Copy link
Contributor Author

The data actually was freed twice. The right thing to do is to have the rtt-typelib deallocate and free it(as was done before), it does call the destructor.

And then i went on a hunt for a leak inside std::strings, first thinking they'd still do copy-on-write(they don't), guessing the deallocation should happen far away. Then wondering why the CNDHandlerConfig's destructor was not destroying its strings(it did), only to find that the temporary string used to push the data into its parent vector was not destroyed.

This leaked one copy of the contents of all containers(typelib speak for strings and vectors) that reside inside another container, at each stage where a container is built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants