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

Parameter service demo fails on macOS with OpenSplice #337

Closed
jacobperron opened this issue May 15, 2019 · 4 comments
Closed

Parameter service demo fails on macOS with OpenSplice #337

jacobperron opened this issue May 15, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@jacobperron
Copy link
Member

Bug report

Required Info:

  • Operating System:
    • macOS
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • OpenSplice
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

Build and run tests for demo_nodes_cpp on macOS with OpenSplice.

Expected behavior

Parameter service related tests pass.

Actual behavior

Tests fail. See example CI: https://ci.ros2.org/job/ci_osx/5821/testReport/

The test failures appear to be caused by a segmentaion fault in the parameter service node.
We see this by running the demos manually:

$ build/demo_nodes_cpp/list_parameters
[INFO] [list_parameters]: Setting parameters...
Segmentation fault: 11

Additional information

This test failure was first noticed after changes related to ros2/ros2#677.
Given the nature of the change, it seems more likely that it uncovered an existing issue rather than introducing the bug directly. Bear in mind that this is all speculation.

@jacobperron jacobperron self-assigned this May 15, 2019
@jacobperron jacobperron added the bug Something isn't working label May 15, 2019
@jacobperron
Copy link
Member Author

I've identified that the segfault is occurring because of a dynamic cast that is failing in the generated file SetParameters_Dcps.cpp:453:

frame #0: 0x0000000101dffbc6 librcl_interfaces__rosidl_typesupport_opensplice_c.dylib`rcl_interfaces::srv::dds_::Sample_SetParameters_Request_DataWriter::_narrow(p=0x0000000103ac0db0) at SetParameters_Dcps.cpp:453
   451 	   if (p && p->_is_a (rcl_interfaces::srv::dds_::Sample_SetParameters_Request_DataWriter::_local_id))
   452 	   {
-> 453 	      result = dynamic_cast < rcl_interfaces::srv::dds_::Sample_SetParameters_Request_DataWriter_ptr> (p);
   454 	      if (result) result->m_count++;
   455 	   }
   456 	   return result;
   457 	}

The result of the dynamic cast is nullptr, which is not guarded against by the calling code.

Even if we guard against the failed cast (which we should anyways), it won't solve this issue.
AFAICT, there is no reason for the dynamic cast to fail. We're casting a DDS::DataWriter * to a rcl_interfaces::srv::dds_::Sample_SetParameters_Request_DataWriter *, which I see is a derived class by looking at the generated code:

class Sample_SetParameters_Request_DataWriter
:
    virtual public DDS::DataWriter
{
...

@dirk-thomas
Copy link
Member

Is this the same as ros2/rmw_opensplice#264?

@jacobperron
Copy link
Member Author

Is this the same as ros2/rmw_opensplice#264?

Maybe, but I didn't notice these specific errors with the parameter demos before ros2/rosidl_typesupport_opensplice#28 was introduced. I could have missed it though.

@jacobperron
Copy link
Member Author

Indeed, looks like a duplicate of ros2/rmw_opensplice#264.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants