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

Segfault when using Parameter Client with spelling like DemoRobot #195

Closed
firesurfer opened this issue Feb 16, 2016 · 3 comments
Closed

Comments

@firesurfer
Copy link

When trying to create a demo application for #193 I got another segfault when using a Parameter Client with a spelling like DemoRobot for the parameter name.

Have a look at my demo application https://github.com/firesurfer/ros2_components_demo
It need the qt5 dev package in order to compile.

The application consists of three parts.
demo_parameter_server
demo_server
demo_client

The segfault happens in the demo_client in the file /src/ros2_components/Robot.h in the function ListAllKnownRobots

@jacquelinekay
Copy link
Contributor

To clarify, you only see the segfault if the name of the parameter is "DemoRobot"? Are you suggesting that the CamelCase name is the cause of the segfault? Or the particular string? That seems to be a dubious cause for the issue. Can you make a more minimal example that reproduces the segfault?

A debugger backtrace from the segfault would also be helpful, if you don't have time to make a MWE.

@dirk-thomas
Copy link
Member

I tried to compile your demo application which took quite a while and some updates. Please make sure that your examples compile correctly out of the box against the latest default branches in the future.

That being said I can reproduce the segfault in the demo_client now:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b053f7 in rclcpp::parameter::ParameterVariant::get_value<(rclcpp::parameter::ParameterType)1> (this=0x0)
    at /home/dthomas/ros/ros2/ws_ros2/src/ros2/rclcpp/rclcpp/include/rclcpp/parameter.hpp:120
120     if (value_.type != rcl_interfaces::msg::ParameterType::PARAMETER_BOOL) {
(gdb) bt
#0  0x00007ffff7b053f7 in rclcpp::parameter::ParameterVariant::get_value<(rclcpp::parameter::ParameterType)1> (this=0x0)
    at /home/dthomas/ros/ros2/ws_ros2/src/ros2/rclcpp/rclcpp/include/rclcpp/parameter.hpp:120
#1  0x00007ffff7b03a06 in rclcpp::parameter::ParameterVariant::as_bool (this=0x0) at /home/dthomas/ros/ros2/ws_ros2/src/ros2/rclcpp/rclcpp/src/rclcpp/parameter.cpp:148
#2  0x00000000004188c7 in ros2_components::Robot::ListKnownRobots (prefix=..., _parentNode=...) at /home/dthomas/ros/ros2/ws_demog/src/ros2_components_demo/src/ros2_components/Robot.h:157
#3  0x000000000041782b in main (argc=1, argv=0x7fffffffb0a8) at /home/dthomas/ros/ros2/ws_demog/src/ros2_components_demo/src/exec/client.cpp:11

And the problem seems to be this - actually this:

(gdb) print this
$1 = (const rclcpp::parameter::ParameterVariant * const) 0x0

@dirk-thomas
Copy link
Member

The client segfaults due to two bugs in your code:

@dirk-thomas dirk-thomas added invalid This doesn't seem right and removed invalid This doesn't seem right labels Feb 17, 2016
nnmm pushed a commit to ApexAI/rclcpp that referenced this issue Jul 9, 2022
…on (ros2#195)

* cmake 3.10 compatibility: pass absolute path to file(GENERATE) function

* passing the right path to add_test is useful too
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

3 participants