fix(agentless): improve session lock reliability#352
Merged
santoshpulluri merged 6 commits intomainfrom Mar 8, 2026
Merged
Conversation
cfcf0c4 to
287991f
Compare
b0bda80 to
9415bbb
Compare
| const LeaderKey = "leader" | ||
|
|
||
| const ( | ||
| // TTL used for Consul sessions created by ESM instances |
Contributor
There was a problem hiding this comment.
Please add elaborate comments to describe the rationale behind setting them
// sessionTTL is the TTL for Consul sessions created by ESM instances.
// The session is automatically invalidated by Consul if it is not renewed
// within this period. Must be longer than the total monitor window
// (sessionMonitorRetries × DefaultMonitorRetryTime) to avoid split-brain,
// where a new leader acquires the lock while the old session is still valid.
sessionTTL = "30s"
// sessionMonitorRetries is the number of consecutive failed attempts to
// contact the Consul servers before the lock is considered lost and the
// session is released. Combined with the default MonitorRetryTime of 2s,
// this gives a monitor window of 6 × 2s = 12s — safely under the 30s
// session TTL, ensuring the session expires before a new leader can
// acquire the lock if Consul is truly unreachable.
sessionMonitorRetries = 6
Contributor
|
Changes looks good for me except for a minor comment about |
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.
Background
We were getting the below errors when we set Consul Http address to a direct Server IP address or an ALB address in the Consul-ESM config file.
Fix
Testing
Tested the binary on 1 ESM instance 3 Consul server setup, got only 3 errors in a span of 3 days
PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.