Skip to content

Commit

Permalink
fix: concurrent panic
Browse files Browse the repository at this point in the history
Call handleUpdatePod directly may lead two workers handle the same pod and panic when write annotation at the same time.
  • Loading branch information
oilbeater committed Apr 29, 2020
1 parent f2dc37c commit 0471594
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func (c *Controller) handleAddPod(key string) error {
if pod.Annotations[util.AllocatedAnnotation] == "true" &&
pod.Annotations[util.RoutedAnnotation] != "true" &&
pod.Spec.NodeName != "" {
return c.handleUpdatePod(key)
c.updatePodQueue.Add(key)
}

return nil
Expand Down
1 change: 0 additions & 1 deletion pkg/speaker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func ParseFlags() (*Configuration, error) {
argNeighborAs = pflag.Uint32("neighbor-as", 65001, "The router as number, default 65001")
argPprofPort = pflag.Uint32("pprof-port", 10667, "The port to get profiling data, default: 10667")
argKubeConfigFile = pflag.String("kubeconfig", "", "Path to kubeconfig file with authorization and master location information. If not set use the inCluster token.")

)

flag.Set("alsologtostderr", "true")
Expand Down

0 comments on commit 0471594

Please sign in to comment.