From 4845daeb35c01895ca99723d821a3620b4cdc1ae Mon Sep 17 00:00:00 2001 From: Yuki Nishiwaki Date: Fri, 19 Oct 2018 10:57:01 +0800 Subject: [PATCH] Don't sort IngressStatus from each Goroutine(update for each ingress) Currently ingress controller try to update status for each ingress resource in a parallel by using Goroutine, and inside this Goroutine we are trying to sort same IngressStatus reference which is shared between all Goroutine, this will break the original refrence if some Goroutine tried to sort exact same time. So we should have done sorting before passing reference to each Goroutine to prevent from breaking original reference fixes: #3269 --- internal/ingress/status/status.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/ingress/status/status.go b/internal/ingress/status/status.go index acf802b34..68303527f 100644 --- a/internal/ingress/status/status.go +++ b/internal/ingress/status/status.go @@ -326,6 +326,7 @@ func (s *statusSync) updateStatus(newIngressPoint []apiv1.LoadBalancerIngress) { defer p.Close() batch := p.Batch() + sort.SliceStable(newIngressPoint, lessLoadBalancerIngress(newIngressPoint)) for _, ing := range ings { batch.Queue(runUpdate(ing, newIngressPoint, s.Client)) @@ -342,8 +343,6 @@ func runUpdate(ing *extensions.Ingress, status []apiv1.LoadBalancerIngress, return nil, nil } - sort.SliceStable(status, lessLoadBalancerIngress(status)) - curIPs := ing.Status.LoadBalancer.Ingress sort.SliceStable(curIPs, lessLoadBalancerIngress(curIPs))