Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash with dynamic bridge #10

Open
BrannonKing opened this issue May 12, 2017 · 3 comments
Open

crash with dynamic bridge #10

BrannonKing opened this issue May 12, 2017 · 3 comments

Comments

@BrannonKing
Copy link

I get a crash when running dynamic_bridge (only) with the coredx middleware. It appears to be an overrun of an array of strings. Not-so-helpful stacktrace:

Backtrace:
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7f79cfd58428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f79cfd5a02a]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x16d)[0x7f79d039184d]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d6b6)[0x7f79d038f6b6]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d701)[0x7f79d038f701]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d919)[0x7f79d038f919]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZSt20__throw_length_errorPKc+0x3f)[0x7f79d03b826f]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x11f099)[0x7f79d0421099]
dynamic_bridge(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIN9__gnu_cxx17__normal_iteratorIPcS4_EEEEvT_SA_St20forward_iterator_tag+0x9e)[0x433cf0]
dynamic_bridge[0x43011c]
dynamic_bridge[0x42ae14]
dynamic_bridge(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IN9__gnu_cxx17__normal_iteratorIPcS4_EEvEET_SA_RKS3_+0x52)[0x426caa]
dynamic_bridge[0x41fc08]
dynamic_bridge[0x422d9c]
dynamic_bridge[0x422c4b]
/home/asi/coredx/ros2_ws/install/lib/librclcpp.so(_ZN6rclcpp8executor8Executor13execute_timerESt10shared_ptrINS_5timer9TimerBaseEE+0x23)[0x7f79d5d9577f]
/home/asi/coredx/ros2_ws/install/lib/librclcpp.so(_ZN6rclcpp8executor8Executor22execute_any_executableESt10shared_ptrINS0_13AnyExecutableEE+0xac)[0x7f79d5d9527e]
/home/asi/coredx/ros2_ws/install/lib/librclcpp.so(_ZN6rclcpp8executor8Executor9spin_onceENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE+0xd8)[0x7f79d5d9500c]
/home/asi/coredx/ros2_ws/install/lib/librclcpp.so(_ZN6rclcpp8executor8Executor26spin_node_once_nanosecondsESt10shared_ptrINS_15node_interfaces17NodeBaseInterfaceEENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE+0x84)[0x7f79d5d94a66]
dynamic_bridge[0x427b31]
dynamic_bridge[0x421359]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f79cfd43830]
dynamic_bridge[0x4194e9]
@BrannonKing
Copy link
Author

I got a debug compilation backtrace:

Thread 1 "dynamic_bridge" received signal SIGABRT, Aborted.
0x00007fc694a5f428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007fc694a5f428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007fc694a6102a in __GI_abort () at abort.c:89
#2  0x00007fc69509884d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007fc6950966b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007fc695096701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007fc695096919 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007fc6950bf26f in std::__throw_length_error(char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007fc695128099 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x0000000000433ce0 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > (this=0x7fffe00e3420, __beg=68 'D', __end=0 '\000') at /usr/include/c++/5/bits/basic_string.tcc:223
#9  0x000000000043010c in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > (this=0x7fffe00e3420, __beg=68 'D', __end=0 '\000') at /usr/include/c++/5/bits/basic_string.h:195
#10 0x000000000042ae04 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > (this=0x7fffe00e3420, __beg=68 'D', __end=0 '\000') at /usr/include/c++/5/bits/basic_string.h:214
#11 0x0000000000426c9a in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, void> (this=0x7fffe00e3420, __beg=68 'D', __end=0 '\000', __a=...) at /usr/include/c++/5/bits/basic_string.h:537
#12 0x000000000041fbf8 in <lambda()>::operator()(void) const (__closure=0x7dd540) at /home/brannon/ros2_coredx_ws/debug/core/src/ros2/ros1_bridge/src/dynamic_bridge.cpp:680
#13 0x0000000000422d8c in rclcpp::timer::GenericTimer<main(int, char**)::<lambda()>, std::chrono::_V2::steady_clock, 0u>::execute_callback_delegate<main(int, char**)::<lambda()>, 0u>(void) (this=0x7dd530)
    at /home/brannon/ros2_coredx_ws/debug/core/install/include/rclcpp/timer.hpp:155
#14 0x0000000000422c3b in rclcpp::timer::GenericTimer<main(int, char**)::<lambda()>, std::chrono::_V2::steady_clock, 0u>::execute_callback(void) (this=0x7dd530)
    at /home/brannon/ros2_coredx_ws/debug/core/install/include/rclcpp/timer.hpp:142
#15 0x00007fc69aa9a7ff in rclcpp::executor::Executor::execute_timer (timer=warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<rclcpp::timer::GenericTimer<main::{lambda()#2}, std::chrono::_V2::steady_clock, (void*)0>, std::allocator<void*>, (__gnu_cxx::_Lock_policy)2>'
warning: RTTI symbol not found for class 'std::_Sp_counted_ptr_inplace<rclcpp::timer::GenericTimer<main::{lambda()#2}, std::chrono::_V2::steady_clock, (void*)0>, std::allocator<void*>, (__gnu_cxx::_Lock_policy)2>'
std::shared_ptr (count 3, weak 1) 0x7dd530)
    at /home/brannon/ros2_coredx_ws/debug/core/src/ros2/rclcpp/rclcpp/src/rclcpp/executor.cpp:302
#16 0x00007fc69aa9a2fe in rclcpp::executor::Executor::execute_any_executable (this=0x7fffe00e3a60, any_exec=std::shared_ptr (count 2, weak 0) 0x7c3cd0)
    at /home/brannon/ros2_coredx_ws/debug/core/src/ros2/rclcpp/rclcpp/src/rclcpp/executor.cpp:234
#17 0x00007fc69aa9a08c in rclcpp::executor::Executor::spin_once (this=0x7fffe00e3a60, timeout=...) at /home/brannon/ros2_coredx_ws/debug/core/src/ros2/rclcpp/rclcpp/src/rclcpp/executor.cpp:205
#18 0x00007fc69aa99ae6 in rclcpp::executor::Executor::spin_node_once_nanoseconds (this=0x7fffe00e3a60, node=std::shared_ptr (count 2, weak 1) 0x7c4c90, timeout=...)
    at /home/brannon/ros2_coredx_ws/debug/core/src/ros2/rclcpp/rclcpp/src/rclcpp/executor.cpp:165
#19 0x0000000000427b21 in rclcpp::executor::Executor::spin_node_once<rclcpp::node::Node, std::ratio<1l, 1000l> > (this=0x7fffe00e3a60, node=std::shared_ptr (count 7, weak 1) 0x7befb0, timeout=...)
    at /home/brannon/ros2_coredx_ws/debug/core/install/include/rclcpp/executor.hpp:172
#20 0x0000000000421349 in main (argc=2, argv=0x7fffe00e3cd8) at /home/brannon/ros2_coredx_ws/debug/core/src/ros2/ros1_bridge/src/dynamic_bridge.cpp:749

@BrannonKing
Copy link
Author

BrannonKing commented May 18, 2017

It appears that the dynamic_bridge assumes that response names have '::' inside them. I modified it to skip those that don't and got this output:

Unsupported publisher: DescribeParameters_Response_
Unsupported publisher: GetParameterTypes_Response_
Unsupported publisher: GetParameters_Response_
Unsupported publisher: ListParameters_Response_
Unsupported publisher: SetParameters_Response_
Unsupported publisher: SetParametersAtomically_Response_

The modification below goes inside the main method of the generated dynamic_bridge.cpp:

        if (publisher_count) {
          std::string suffix("Reply");
          auto position = it.first.rfind(suffix);
          if (position != std::string::npos && position == it.first.size() - suffix.size()) {
            std::string & t = it.second;
            std::string name(it.first.begin(), it.first.end() - suffix.size());
            if (active_ros2_services.find(name) == active_ros2_services.end()) {
              active_ros2_services[name] = std::map<std::string, std::string>();
            }
            auto colons = t.rfind("::");
            auto rspnse = t.rfind("_Response_");
            if (colons != std::string::npos && rspnse != std::string::npos) {
              std::string srv(t.begin() + colons + 2, t.begin() + rspnse);
              std::string pkg(t.begin(), t.begin() + colons);
              active_ros2_services[name]["package"] = pkg;
              active_ros2_services[name]["name"] = srv;
              active_ros2_services[name]["response_topic"] = it.first;
              active_ros2_services[name]["response_type"] = t;
            }
            else { std::cout << "Unsupported publisher: " << t << std::endl; }
          } else {
            ros2_publishers[it.first] = it.second;
          }
        }

I guess I'm not sure if this is a bug with the dynamic_bridge or if the rmw_coredx is not following some generated-topic naming standard.

@ClarkTucker
Copy link
Contributor

Hmm. OK. Those strings look like they might be the 'type' of request/reply topics. In CoreDX DDS, we tend to use the 'short' typename instead of fully-qualified typename for things like this. If ROS assumes/requires a fully-qualified typename here, then this might be the issue. I'll look into it a bit further...

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

No branches or pull requests

2 participants