-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent LoadBalancer updates on follower. #6872
base: main
Are you sure you want to change the base?
Conversation
Follower instances of Contour do not run loadBalancerStatusWriter and therefore do not read from the channel that receives status updates. The LoadBalancer status updates are still watched and sent to a channel, causing the go routine to block. This led to LoadBalancer updates piling up and consuming memory, eventually causing an out-of-memory condition and killing the Contour process. Signed-off-by: Tero Saarni <[email protected]>
8b2af7d
to
920d0ce
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6872 +/- ##
==========================================
- Coverage 81.05% 81.04% -0.02%
==========================================
Files 133 133
Lines 20026 20034 +8
==========================================
+ Hits 16232 16236 +4
- Misses 3500 3504 +4
Partials 294 294
|
func (s *ServiceStatusLoadBalancerWatcher) notify(lbstatus core_v1.LoadBalancerStatus) { | ||
s.LBStatus <- lbstatus | ||
if s.leader.Load() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to lose the envoy service event in this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. Currently the event processing logic relies on Added/Updated/Deleted events alone. It works for other resource types as they will be processed by all Contour instances but I think new approach is needed with the load balancer status updates.
This PR fixes a memory leak that was triggered by LoadBalancer status updates. Only the leader instance runs
loadBalancerStatusWriter
and therefore follower does not have anyone reading from the channel that receives status updates. The LoadBalancer status updates are still watched by followers and sent to the channel, causing the go routine callingServiceStatusLoadBalancerWatcher.notify()
to block. This led toLoadBalancerStatus
updates piling up and consuming memory, eventually causing an out-of-memory condition and killing the Contour process.Fixes #6860