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
The simplest solution would be adding a mutex, with getter and setter to the state and use it to syncronise the goroutines when accessing the state.
E.g.
I found the following data race in ginkgo. It happens when a suite receives a SIGINT (or Ctrl-C).
Step to reproduce
ginkgo -race
Ctrl-C
Example output
The problem
I think the problem is the following.
Ginkgo register for interrupts in the
registerForInterrupts
function, which is called in a goroutine here.When it receives a SIGINT,
registerForInterrupts
calls thereportSuiteDidEnd
function here, which in turn, callssuiteDidEndSummary
.The latter filters the specs by state in order to create a summary. However, the state is also being accessed by the "main" spec runner here.
Hence the data race reported by go:
The solution
The simplest solution would be adding a mutex, with getter and setter to the state and use it to syncronise the goroutines when accessing the state.
E.g.
What do you think?
If this solution looks good to you I can open a PR fairly quickly.
The text was updated successfully, but these errors were encountered: