Bugfix: Close heartbeat thread more reliably#54
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What and why?
The boardwalk CLI pushes a heartbeat, using a separate thread, to the boardwalkd server (when one is configured) while it's running. In very rare cases, the heartbeat thread was not closing, because the thread was being closed improperly by attempting to cancel a future. Cancelling futures is not a reliable way to close a thread because it will always fail to be cancelled if the thread is currently running an operation. This issue has been seen rarely because the heartbeat has to be running at the moment the cancel attempt is made.
This changes the way the heartbeat thread is closed by instead passing an event object into the thread, which can then be manipulated outside of the thread.
How was this tested?
Tested locally in debug mode by attempting to exit the boardwalk CLI multiple times while the heartbeat was running. Ensured the debug message output shows that the thread's exit condition is being met.
Checklist