Revert "Speculative workaround for #74890"

This commit is contained in:
Lubomir I. Ivanov 2019-03-15 03:59:44 +02:00 committed by GitHub
parent d5a3db0039
commit 4eabc1cc16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@ import (
"path/filepath" "path/filepath"
"regexp" "regexp"
"strings" "strings"
"sync/atomic" "sync"
"time" "time"
"k8s.io/apimachinery/pkg/util/version" "k8s.io/apimachinery/pkg/util/version"
@ -434,19 +434,11 @@ type chaosMonkeyAdapter struct {
func (cma *chaosMonkeyAdapter) Test(sem *chaosmonkey.Semaphore) { func (cma *chaosMonkeyAdapter) Test(sem *chaosmonkey.Semaphore) {
start := time.Now() start := time.Now()
var once sync.Once
// Using an atomic with a CAS is a potential workaround for #74890.
//
// This is a speculative workaround - we are really seeing if
// this is better; if not we should revert.
//
// If it is better we should file a bug against go 1.12, and
// then revert!
var onceWithoutMutex uint32
ready := func() { ready := func() {
if atomic.CompareAndSwapUint32(&onceWithoutMutex, 0, 1) { once.Do(func() {
sem.Ready() sem.Ready()
} })
} }
defer finalizeUpgradeTest(start, cma.testReport) defer finalizeUpgradeTest(start, cma.testReport)
defer ready() defer ready()