Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unlikely data race when calling BaseExecutor methods
Calling these methods defined on a value receiver copies the BaseExecutor instance and could cause a data race if another goroutine is writing to it. In practice this wasn't a problem and unlikely anyone would ever run into it on master, but it did appear on the feat/1320-execution-api branch (#1863) when running: go run -race main.go run --quiet -u 5 -i 5 'github.com/k6io/k6/samples/http_get.js' Clipped stack trace: WARNING: DATA RACE Write at 0x00c00050d7a8 by main goroutine: go.k6.io/k6/lib/executor.(*SharedIterations).Init() /home/ivan/Projects/k6io/k6/lib/executor/shared_iterations.go:179 +0x384 go.k6.io/k6/core/local.(*ExecutionScheduler).Init() /home/ivan/Projects/k6io/k6/core/local/local.go:276 +0xc1c go.k6.io/k6/core.(*Engine).Init() /home/ivan/Projects/k6io/k6/core/engine.go:190 +0x148 go.k6.io/k6/cmd.getRunCmd.func1() /home/ivan/Projects/k6io/k6/cmd/run.go:248 +0x1ad7 ... Previous read at 0x00c00050d7a8 by goroutine 32: go.k6.io/k6/lib/executor.(*SharedIterations).GetProgress() <autogenerated>:1 +0x85 go.k6.io/k6/cmd.getRunCmd.func1.1() /home/ivan/Projects/k6io/k6/cmd/run.go:180 +0x13d Also see grafana/k6#1863 (comment) .
- Loading branch information