fix(robot-server): clear ChangeNotifier's internal event immediately after waiting #15103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes RQA-2677
Overview
ChangeNotifier is the interface for alerting robot-server of notification updates deriving from Protocol Engine. Protocol Engine
notify()
ies, and the PublisherNotifierwait()
s. After the event flag is set() innotify()
, the PublisherNotifier no longer waits (correctly). However, the event flag isn't cleared immediately on receiving a new event...it's cleared after PublisherNotifer fires all its registered callbacks. This causes some events to be dropped if Protocol Engine tries setting the flag before PublisherNotifier has gotten around to clearing it... woops.The reason we haven't seen this problem earlier is because we currently don't have too many immediately back-to-back events firing with publishers that would be interested in those events, but in the specific scenario mentioned in the ticket, the following is happening:
notify()
.True
toTrue
redundantly.False
...dropping these new events.The fix: simply clear the event flag immediately after waiting.
Test Plan
Changelog
Risk assessment
low