Skip to content

Bugfix: Close heartbeat thread more reliably#54

Merged
m4wh6k merged 1 commit intomainfrom
bugfix-heartbeat-close
Jan 10, 2023
Merged

Bugfix: Close heartbeat thread more reliably#54
m4wh6k merged 1 commit intomainfrom
bugfix-heartbeat-close

Conversation

@m4wh6k
Copy link
Copy Markdown
Contributor

@m4wh6k m4wh6k commented Jan 10, 2023

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

  • Have you updated the VERSION file (if applicable)?

Copy link
Copy Markdown
Contributor

@asullivan-blze asullivan-blze left a comment

Choose a reason for hiding this comment

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

LGTM.

@m4wh6k m4wh6k merged commit 1f06045 into main Jan 10, 2023
@m4wh6k m4wh6k deleted the bugfix-heartbeat-close branch January 10, 2023 21:23
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