fix: rosbridge_websocket cooperative shutdown#1048
Conversation
|
@bjsowa can you give this a look? thanks |
|
Is switching to MultiThreadedExecutor necessary? I believe we are trying to avoid it due to some existing bugs that may lead to a deadlock. (@sea-bass or @MatthijsBurgh might know more). I think I got cooperative shutdown to work well in #1040 but it is not passing tests due to bugs in rclpy which I am trying to fix but couldn't find time to finish. |
|
|
|
Thanks all for the feedback MultiThreadExecutor, + ReentrantCallbackGroup might help with some of that deadlock (handwavy gestures at threading.RLock) But that indicates changes inside the node wherever it has such a mutexed object It does seem necessary, without it there is some circular dependency But if this is going to be throwaway in light of #1040, then we can put this to bed in favor of that and it's other benefits |
|
See #981 and ros2/rclpy#1223. This is probably still an issue. |
|
@sea-bass There are no problems with using |
|
The Though I think the entire executor change in this PR is not needed to fix the shutdown issues. |
Whoa, I did not know about this. Thank you! |
|
Hi @bjsowa @MatthijsBurgh @sea-bass , I got it to work with SingleThreadExecutor If you think the ok() check after spin_once is redundant, I can remove it |
MatthijsBurgh
left a comment
There was a problem hiding this comment.
Would be possible to create a test for your case? So we have a test for a robust shutdown.
|
@cyan-at Would be possible to create a test for your case? So we have a test for a robust shutdown. |
|
@MatthijsBurgh I was looking at the existing test suites I saw a lot of Do you have any suggestions? |
|
@MatthijsBurgh I don't think this change warrants a test, and I worry adding a test might introduce other changes out of scope I can provide a test report i.e. before vs after behavior in this PR and I hope that would be sufficient |
|
Waiting for a final review of @bjsowa. You can merge it if you approve |
|
Thanks all! |
* rosbridge_websocket cooperative shutdown necessary changes * switch back to singlethread, check for ok BEFORE spinning also * address MatthijsBurgh comments
* rosbridge_websocket cooperative shutdown necessary changes * switch back to singlethread, check for ok BEFORE spinning also * address MatthijsBurgh comments
Public API Changes
None
Description
We use this package in a systemctl
When we do
systemctl ... stop <our.service>, a common thing blocking shutdown is this processWe can work around it, and locally do
systemctl ... stop --forcebut this patch isn't global and not idealI tested some local changes to this code to make it cooperate, without any obvious regressions
I made no issues, but maybe one exists or I can make one for tracking