-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUGFIX: accidentally altering 'decorators' slice #620
BUGFIX: accidentally altering 'decorators' slice #620
Conversation
… alters the original decorators slice; causing eg. trackers to be shared across instantiations, breaking thread-safety and causing errors Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
it looks like there aren't
and opened PRs with this cherry-picked against those branches at https://github.com/liggitt/cel-go/pulls |
I just found out that WARNING: DATA RACE
Write at 0x00c0005f86f8 by goroutine 25:
github.com/google/cel-go/cel.newProgram.func1()
/home/username/go/pkg/mod/github.com/google/cel-go@v0.12.5/cel/program.go:231 +0x4d3
github.com/google/cel-go/cel.(*progGen).ContextEval()
/home/username/go/pkg/mod/github.com/google/cel-go@v0.12.5/cel/program.go:393 +0x1b0
k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel.(*Validator).validateExpressions()
/home/username/go/pkg/mod/k8s.io/apiextensions-apiserver@v0.25.4/pkg/apiserver/schema/cel/validation.go:216 +0xc31
k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel.(*Validator).Validate()
/home/username/go/pkg/mod/k8s.io/apiextensions-apiserver@v0.25.4/pkg/apiserver/schema/cel/validation.go:147 +0x1dc
k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel.(*Validator).validateMap()
/home/username/go/pkg/mod/k8s.io/apiextensions-apiserver@v0.25.4/pkg/apiserver/schema/cel/validation.go:342 +0x10bc
k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel.(*Validator).Validate() |
@TristonianJones is parallel evaluation tested in this repo? if so, are there CI tests that run those in race mode? |
@liggitt There are parallel evaluation tests for the parser, checker, and interpreter, but the top-level |
I spent my afternoon trying to find the root cause for kubernetes/kubernetes#114661. And this led me to this bug.
The factory function incorrectly calls
append(decorators, ...)
which alters the original decorators slice.This can result in the
costTracker
being shared across instances in a concurrent scenario, further causing bugs.The bug (kubernetes/kubernetes#114661) originated from calling the
tracker.stack.dropArgs(...)
function from multiple goroutines at the same time (which shouldn't be possible normally), breaking multithreading safety.