-
Notifications
You must be signed in to change notification settings - Fork 118
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
Regression in Rolling: error "cannot publish data, at ./src/rmw_publish.cpp:66" during shutdown of binary #761
Comments
Although this issue exhibits the same error message and behavior as #760, it seems to have a different source, as the corresponding Iron build works fine for me. |
CC: @Barry-Xu-2018 |
@rhaschke quick question. do you have this problem only with rmw_fastrtps? not with |
In my environment, when I switched to CycloneDDS, no issues came up. @rhaschke I wonder if the test results in your environment are the same. I have to use ctrl + c to terminate execution.
|
Yes. I don't face the problem with Cyclone. I was not able to test with Connext as the middleware implementation is not found for some reason. I tried both, |
I never observed execution freezing as reported by @Barry-Xu-2018. |
After checking test code, I find rclcpp::shutdown() is never called. There weren't any issues before, so it might have just been luck. To quickly verify this, I added I tested modified codes 10 times in my environment and the issue didn't come up again. |
Adding |
Calling |
I just wanted to quickly check an idea. Putting a shutdown in a test isn't really appropriate.
Yes. This is a problem.
It is used to gracefully shut down ROS 2 nodes and associated resources (The correct order of release).|
Yes, there are other reasons too. I'll continue to investigate this. |
The failure is related to Since I'm not very familiar with the relevant code, I don't quite understand the use of static here. When the introspection node is removed, the introspection node resources are not released immediately. Instead, it is released when the static IntrospectionExecutor is destroyed (At this time, it seems that fastdds resources are already gone). The following modification is a workaround.
I will continue to investigate, after the introspection node is removed from the executor, and why the introspection node's resources are still being released when the executor's resources are released. |
Thanks for tracking this down to the static executor, which is indeed bad practise. I'm still wondering, why this worked in Humble. |
I guess it is related to this change ros2/rclcpp#2143. |
For fastdds, when the program ends, fastdds resources start to release by Destructor.
As for why cyclonedds doesn't have this issue, I believe it's because cyclonedds doesn't release its resources when the program exits (fastdds use Destructor). Therefore, when the static executor is being destructed, it can still access those resources. These resources are eventually reclaimed by the operating system. So I think this code should be changed. |
In addition, I found, after canceling, the Executor did not correctly release shared pointer of resources in time. In this case, executor is static. So fastdds resources is released by Destructor before Executor free them. Before return, After carefully verifying the impact, I will submit the fix to the rclcpp repository. |
I have created a PR ros2/rclcpp#2556 to fix the issue in Executor. |
I only found time to come back to this issue now. Removing the static executor resolves the issue for me. |
Bug report
In Rolling, I observe weird segfaults during shutdown of the test binary:
Humble and Iron don't exhibit this issue.
WORKAROUND: Bypassing normal cleanup routines by calling
quick_exit()
.Required Info:
Steps to reproduce issue
in docker:
Expected behavior
Binary shuts down cleanly after tests.
Actual behavior
Binary throws error message and segfaults:
The text was updated successfully, but these errors were encountered: