-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Dynamically changing parameters in controller_server while computeControl is running causes deadlock #2833
Comments
That is explicitly unsupported. It is dangerous to change controller parameters while an existing plugin is running. Changing of kinematic values or other core-behavioral parameters during execution could cause unstable behavior. This is a unique attribute of the controller server since this server deals with-- well.. the control 😉 . However a dead lock is a pretty crappy way of handling, I agree. I'd support changing the Does that work for you? |
Got a version running with try_lock that rejects parameter changes while running, prints a failure message and returns a corresponding failure result. Could open a PR for that. |
Please do!
Good question. If memory serves @doisyg wanted the ability to change parameters in those systems on the fly. I would generally agree that changing these mid-request is not good practice, but I don't think it has the same instability potential unless being changed multiple times in a small window. Let us see what he says |
Hi! However, I definitely need to be able to change some parameters of the controller while As for the parameters of the |
So I think for now, we leave the plugins as-is but reject dynamic updates for the controller server itself. The alternative is to fix the deadlock issue, which would be fine as well if someone preferred still being able to change the parameters at runtime and had a good reason for doing so. We do still need a mutex though to make sure that we don't have read/writes at the same time, but we can redesign |
Actually fixing the deadlock would be preferable probably. |
I'm not sure there's a good safe way to do that though other than atomic variables -- which we could employ here and remove the mutex. There's no classes being updated from parameter updates, only variables, so if we use atomic variables, then there's no reason they couldn't be left open without a mutex to wrap it. That seems like the move here. I was thinking about adding the lock in the
That seems entirely reasonable. |
Any update here? |
Sry I was on a business trip, created a pull request now. |
Bug report
Required Info:
Steps to reproduce issue
Use ParameterClient for controller_server from another node to dynamically change any parameters of controller_server while computeControl https://github.com/ros-planning/navigation2/blob/0a961df9cbe50356484877681abfdbeae6ba7b33/nav2_controller/src/controller_server.cpp#L344 is currently running.
Expected behavior
dynamicParametersCallback in controller_server.cpp https://github.com/ros-planning/navigation2/blob/0a961df9cbe50356484877681abfdbeae6ba7b33/nav2_controller/src/controller_server.cpp#L597 is blocked until we reach the current goal.
Actual behavior
I added an output right at the start of https://github.com/ros-planning/navigation2/blob/0a961df9cbe50356484877681abfdbeae6ba7b33/nav2_controller/src/controller_server.cpp#L344
Entering the the dynamicParametersCallback while computeControl is running causes a deadlock, controller_server stops sending a heartbeat and is shutdown.
Despite what was said in #2704 they seem to be running in the same thread, which causes the deadlock, as computeControl holds the mutex until it has reached the goal or it gets aborted.
If you remove the mutex from dynamicParametersCallback changing the parameters while computeControl is running works fine.
I'm however not sure why this causes follow_path to abort the current goal handle.
The text was updated successfully, but these errors were encountered: