You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running go test -race against app-functions-sdk-go, go race detector reports several data race errors for Batch function. A data race happens when two goroutines access the same variable concurrently, and at least one of the accesses is a write. Theoretically, data races imply unpredictable behavior and may lead to strange result.
Follow procedures below to use go race detector to observe data races from Batch function:
After analyzing those data races as listed in #448, there're two
variables shall be in atomic operation to avoid data races:
1. batchData
2. timerActive
This commit from the batchData [][]byte to atomicBatchData to avoid data
race and update timerActive from bool to atomicBool to avoid data race
Signed-off-by: Jude Hung <jude@iotechsys.com>
When running go test -race against app-functions-sdk-go, go race detector reports several data race errors for Batch function. A data race happens when two goroutines access the same variable concurrently, and at least one of the accesses is a write. Theoretically, data races imply unpredictable behavior and may lead to strange result.
Follow procedures below to use go race detector to observe data races from Batch function:
checkout repositories
git clone git@github.com:edgexfoundry/app-functions-sdk-go.git
Change directory to the local repository
cd app-functions-sdk-go/pkg/transforms
Run go race detector
go test -race -run=Batch
There will be 12 data races detected, as shown below:
The text was updated successfully, but these errors were encountered: