-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dynamolock/v2: introduce individual timeouts to automatic heartbeats
In the process of investigating #446, the issue reporters uncovered that heartbeats were using a context.Background(). When the public interface got refactored to use contexts (with the upgrade to AWS Go SDK v2), this particular part of the code remained untouched by me. In the same issue, the reporter claims that SessionMonitors are flaky. I could not reproduce the problem in my own environment, by as a policy I assumed the report is accurate. In a world in which this problem does happen, one of the sources of the misbehavior would be the fact that Heartbeats would take too long to execute, holding the lock longer than it should, and effectively derailing the test inside SessionMonitor code. In this situation, when it finally came around, the lock would be already lost and the session monitor would've never been called. This commit attempts to address this issue by introducing individual timeouts to each SendHeartbeat call. As this change was being iterated, I could see that the locks heartbeat loop could take very long to run. In the past it was possible to get away with it because all locks would get a chance, with this change though, it runs on a time budget and they have to run as quickly as possible within c.heartbeatPeriod. This commit also adds specific tests cases that attempt to replicate the network connectivity issue declared in #446 (refer to TestSessionMonitorMissedCall).
- Loading branch information
Showing
8 changed files
with
275 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.