-
Notifications
You must be signed in to change notification settings - Fork 225
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
wait_for_message Accumulating CPU Load After Repeated Calls #1179
Comments
Fix is simple: just unsubscribe before return (tested). This should work assuming that there is no exception in between. |
Yes, we should definitely destroy the subscription. I think we should put it into a |
Added try finally block and I tested it can destroy_subscription when:
|
Signed-off-by: KKSTB <[email protected]>
* Fix to issue #1179 Signed-off-by: KKSTB <[email protected]>
@KKSTB i was thinking probably we want to backport this to iron and humble, since this affects user platform. what do you think? besides, the issue was originally created with iron. |
Signed-off-by: KKSTB <[email protected]>
Ah you are right. Thank you for reminding me. |
Signed-off-by: KKSTB <[email protected]>
@KKSTB @fujitatomoya @clalancette I noticed that it already exists in Rolling and Iron. |
Actually I tested that the wait_for_message function is also affected by this issue: If wait_for_message is called many times the executor may sometimes throw exception saying it's using a destroyed subscription. So I actually gave up in using this function in my application. I changed to permanently subscribe to topic instead. |
Hi, we would like to use this in humble as well. Is there any progress regarding the backport? |
@tiesus currently nobody is working on that, but i think that is acceptable. CC: @clalancette |
* Fix to issue ros2#1179 Signed-off-by: KKSTB <[email protected]>
* Fix to issue ros2#1179 Signed-off-by: KKSTB <[email protected]> Signed-off-by: Tomoya Fujita <[email protected]>
humble backport: #1272 |
Great. That helps us a lot to get rid of ros1. |
* Add feature of wait for message (#953). (#960) * Add feature of wait for message. Signed-off-by: Lei Liu <[email protected]> Signed-off-by: Tomoya Fujita <[email protected]> * Fix to issue #1179 (#1180) * Fix to issue #1179 Signed-off-by: KKSTB <[email protected]> Signed-off-by: Tomoya Fujita <[email protected]> * Allow specifying qos (#1225) * Allow specifying qos Signed-off-by: Tim Clephas <[email protected]> --------- Signed-off-by: Lei Liu <[email protected]> Signed-off-by: Tomoya Fujita <[email protected]> Signed-off-by: KKSTB <[email protected]> Signed-off-by: Tim Clephas <[email protected]> Co-authored-by: Lei Liu <[email protected]> Co-authored-by: KKSTB <[email protected]> Co-authored-by: Tim Clephas <[email protected]>
Bug report
Required Info:
Steps to reproduce issue
Expected behavior
CPU% stays the same after the for loop
Actual behavior
CPU% increased and does not drop
Additional information
py-spy record -n -r 10 -p [PID]
indicates high CPU load at _take_subscription (rclpy/executors.py 338 https://github.com/ros2/rclpy/blob/e9bd428ed562019596e8d3964489bab90a85b203/rclpy/rclpy/executors.py#L338C25-L338C43).The text was updated successfully, but these errors were encountered: