-
Notifications
You must be signed in to change notification settings - Fork 308
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
Adding extra time counter to exit while loop so that controller manager doesn't freeze #458
Adding extra time counter to exit while loop so that controller manager doesn't freeze #458
Conversation
Hi @bmagyar! Can you please look into the PR? You commented on the previous issue I posted which I fixed in this PR. Thank you. Kindly let me know! |
@bmagyar can you let us know the status of this? This is a known bug in the controller manager. |
@bmagyar -- still no updates on this. Have you been able to verify that this bug occurs on your end? |
Thanks for the fix, I'm releasing this now to melodic and noetic! |
Thank you so much @bmagyar! |
This PR addresses issue #443. When I switch the controllers sometimes the controller manager is stuck here at this unending while loop. The problem I am facing is similar to #265. The only way out of this loop is either when
In the first case, switch_params_.do_switch becomes False if switching is successful which is the ideal case
Exiting ROS Core means either simulation is shutdown or ROS core exited with non zero exit code
If the timeout is specified after the timeout the switching is stopped and the response code returned back is False. The timeout is calculated using the ROS time. When I ran my simulation using Gazebo the ROS time freezes hence the timeout is never possible. Due to this issue, the code is stuck at the aforementioned while loop and never comes out. This gives rise to Denial of Service. The simulation seems to be stuck. No further switching of controllers happen. Even the controller manager does not list the current controllers which are stopped or running because the controller manager is in denial of service and it's lock is not released. The only way out of this is to restart the entire simulation.
Hence I have added a time check in the while loop which uses system time contrary to ROS time and if something like this happens at least the code can safely exit rather than go into denial of service. The code edits suggested in this PR will give every opportunity for ROS time to function but it will also monitor the timeout from a system clock perspective and after timeout+1 seconds if the while loop didn't break, it will forcibly break out of the while loop. Finally when the while loop is exited by forcibly breaking out "False" is returned signaling the end-user that controller switching wasn't successful.