improbable-eng / etcd-cluster-operator

A controller to deploy and manage etcd clusters inside of Kubernetes
MIT License
128 stars 35 forks source link

Fix some race conditions #123

Closed wallrj closed 4 years ago

wallrj commented 4 years ago

The controller-runtime manager.Start doesn't wait for all its go-routines to finish, which leads to another race when the controller runtime attempts to log (via t.Log) after a test has finished. See:

Part of: #117

wallrj commented 4 years ago

You can see the leaked goroutine in the test results;

Goroutine 270 (running) created at:
  sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start()
      /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.3.0/pkg/internal/controller/controller.go:157 +0x4ee
  sigs.k8s.io/controller-runtime/pkg/manager.(*controllerManager).startLeaderElectionRunnables.func1()
      /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.3.0/pkg/manager/internal.go:326 +0x74

--- https://app.circleci.com/jobs/github/improbable-eng/etcd-cluster-operator/668/parallel-runs/0/steps/0-102

wallrj commented 4 years ago

I've removed the -race parameter now. We will have to enable the race checks once the bug has been fixed in controller-runtime. Meanwhile this fixes three of the race conditions.