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
If multiple calls are made in parallel on the same file, a race will occur between modifying the stored file offset and reading/writing the file, causing these functions to return or write incorrect data. Additionally, it is not expected that the underlying seek offset is modified at all. A corrected implementation will likely have to extract and re-implement parts of Read/Write in order to not affect the saved offset.
The text was updated successfully, but these errors were encountered:
k3an3
changed the title
mem.ReadAt/mem.WriteAt` violates spec and subject to race conditionsmem.ReadAt/mem.WriteAt violates spec and subject to race conditions
Nov 20, 2024
Note in the Go 1.23.3 docs for the
io.WriterAt
interface:However, the current implementations of MemFS ReadAt/WriteAt look like this, respectively:
afero/mem/file.go
Lines 226 to 232 in 5c4385a
afero/mem/file.go
Lines 300 to 303 in 5c4385a
If multiple calls are made in parallel on the same file, a race will occur between modifying the stored file offset and reading/writing the file, causing these functions to return or write incorrect data. Additionally, it is not expected that the underlying seek offset is modified at all. A corrected implementation will likely have to extract and re-implement parts of Read/Write in order to not affect the saved offset.
The text was updated successfully, but these errors were encountered: