mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Speculative workaround for #74890
We try using an atomic with a CAS, as a potential workaround for issue #74890. Kudos to @neolit123 for the investigation & idea. 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! Issue #74890
This commit is contained in:
parent
c67e16c74f
commit
803de74685
@ -24,7 +24,7 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
@ -434,11 +434,19 @@ type chaosMonkeyAdapter struct {
|
||||
|
||||
func (cma *chaosMonkeyAdapter) Test(sem *chaosmonkey.Semaphore) {
|
||||
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() {
|
||||
once.Do(func() {
|
||||
if atomic.CompareAndSwapUint32(&onceWithoutMutex, 0, 1) {
|
||||
sem.Ready()
|
||||
})
|
||||
}
|
||||
}
|
||||
defer finalizeUpgradeTest(start, cma.testReport)
|
||||
defer ready()
|
||||
|
Loading…
Reference in New Issue
Block a user