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
While working on #17062 I have discovered a rare race condition that happens when we fail to write to the destination file. Which is what the test introduced in #17062 does.
In be.backupFile we have a createAndCopy function that will copy one file (reader) to another (writer). In this function we call io.Copy(writer, reader) which in turns call pargzip.Writer.init, this init method starts a goroutine that writes chunks. While this goroutine is non-blocking, we go up the stack and go back to createAndCopy, which returns and ends up calling its defer function, in this defer we flush the same writer that is called in the goroutine instanced by pargzip.Writer.init leading to a data race.
Overview of the Issue
While working on #17062 I have discovered a rare race condition that happens when we fail to write to the destination file. Which is what the test introduced in #17062 does.
In
be.backupFile
we have acreateAndCopy
function that will copy one file (reader
) to another (writer
). In this function we callio.Copy(writer, reader)
which in turns callpargzip.Writer.init
, thisinit
method starts a goroutine that writes chunks. While this goroutine is non-blocking, we go up the stack and go back tocreateAndCopy
, which returns and ends up calling its defer function, in this defer we flush the same writer that is called in the goroutine instanced bypargzip.Writer.init
leading to a data race.Full stack trace:
Reproduction Steps
Run the test in d04aec6 (#17062) with -race
Binary Version
Operating System and Environment details
Log Fragments
No response
The text was updated successfully, but these errors were encountered: