Skip to content

Conversation

tylerjw
Copy link
Contributor

@tylerjw tylerjw commented Sep 6, 2022

This fixes a deadlock condition in update_dynamic_parameters. The reason for the deadlock is that when it was declaring new parameters, the mutex was locked and the update callback would be called that would also try to lock the mutex.

To fix this, I updated all the usage of the internal state params_ to only be accessed through the getter method and a new private setter method. This means that the methods inside ParamListener only lock the mutex to copy or write to this internal state value instead of locking for the full duration of some of the methods that can cause callbacks to fire that might also need to lock the mutex.

@tylerjw tylerjw requested a review from destogl September 6, 2022 14:57
Copy link
Contributor

@destogl destogl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It looks good to me!

@tylerjw tylerjw merged commit 0b256ac into PickNikRobotics:main Sep 7, 2022
@tylerjw tylerjw deleted the fix_deadlock branch September 7, 2022 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants