ros2 / rosidl_typesupport

Packages which provide the typesupport for ROS messages and services
Apache License 2.0
13 stars 34 forks source link

Downgrade benign error messages to debug #107

Closed asorbini closed 3 years ago

asorbini commented 3 years ago

This PR changes the severity level of two messages logged by the get_typesupport_handle_function() functions in rosidl_typesupport_c and rosidl_typesupport_cpp, from error to debug.

As far as I can gather from inspecting and debugging the code, these functions are used to look up a specific type support by name, and the current "error condition" is actually just a benign case of an available type support not matching the sought after identifier.

I'm still unsure of how the condition is actually triggered, but these error messages show up at times in applications running on rmw_connextdds and can become quite intrusive (see ros2/rmw_connextdds#21 for an example).

After debugging rmw_connextdds, I've confirmed that these errors are printed when the RMW tries to look up one of the type supports it needs (e.g. see here). The error is always printed only for rosidl_typesupport_cpp, and I haven't been able to determine why it doesn't also appear at times for other type supports, or why it doesn't happen all the time.

Any input on uncovering these answers is of course welcome, but since the condition seems to be benign (even if only from empirical observation), I would like to downgrade the errors to reduce their intrusiveness.

asorbini commented 3 years ago

Two unit tests failed with this change:

1: [ RUN      ] TestMessageTypeSupportDispatch.get_handle_function
1: /tmp/ws/src/rosidl_typesupport/rosidl_typesupport_c/test/test_message_type_support_dispatch.cpp:91: Failure
1: Value of: rcutils_error_is_set()
1:   Actual: false
1: Expected: true
1: 
1: >>> [rcutils|error_handling.c:108] rcutils_set_error_state()
1: This error state is being overwritten:
1: 
1:   'Failed to get symbol 'test_message_type_support' in library: error not set, at /tmp/ws/src/rosidl_typesupport/rosidl_typesupport_c/src/type_support_dispatch.hpp:102'
1: 
1: with this new error message:
1: 
1:   'Failed to find symbol 'test_message_type_support2' in library, at /tmp/ws/src/rosidl_typesupport/rosidl_typesupport_c/src/type_support_dispatch.hpp:96'
1: 
1: rcutils_reset_error() should be called after error handling to avoid this.
1: <<<
1: [  FAILED  ] TestMessageTypeSupportDispatch.get_handle_function (641 ms)
2: [ RUN      ] TestServiceTypeSupportDispatch.get_handle_function
2: /tmp/ws/src/rosidl_typesupport/rosidl_typesupport_cpp/test/test_service_type_support_dispatch.cpp:88: Failure
2: Value of: rcutils_error_is_set()
2:   Actual: false
2: Expected: true
2: [  FAILED  ] TestServiceTypeSupportDispatch.get_handle_function (642 ms)

I'll wait for input from the maintainers before taking any further action.

asorbini commented 3 years ago

I just noticed #102 which addresses the same problem. I'll close this PR and wait for that one to be merged, hopefully in time for Galactic, or for a patch soon after 🤞🏼