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
We can see that we always use the same err in each goroutine, as = is used. This can lead to a race condition where errors are never propagated. For example, say we have two signatures, so two goroutines. It is possible that something like signatures[i].Payload, err = sig.Payload() is called and returns an error for one goroutine, but before it checks if err != nil, we context switch to the other goroutine which gives us err = nil in signatures[i].Payload, err = sig.Payload(). Then, we will never catch the error in either goroutine.
Version
I am using v1.12.1, but from what I can tell, this has been around since this PR, which has been around since v1.2.1.
The text was updated successfully, but these errors were encountered:
Description
For each fetched signature, a new goroutine is spawned here. Each of these goroutines use the same
err error
variable, originally declared here.To make it a bit easier to read, I will copy and paste the code below:
We can see that we always use the same
err
in each goroutine, as=
is used. This can lead to a race condition where errors are never propagated. For example, say we have two signatures, so two goroutines. It is possible that something likesignatures[i].Payload, err = sig.Payload()
is called and returns an error for one goroutine, but before it checksif err != nil
, we context switch to the other goroutine which gives userr = nil
insignatures[i].Payload, err = sig.Payload()
. Then, we will never catch the error in either goroutine.Version
I am using v1.12.1, but from what I can tell, this has been around since this PR, which has been around since v1.2.1.
The text was updated successfully, but these errors were encountered: