diskv icon indicating copy to clipboard operation
diskv copied to clipboard

ReadStream/WriteStream can lead to data races

Open floren opened this issue 3 years ago • 0 comments

If someone calls ReadStream, then proceeds to read from it slowly, then someone else calls WriteStream, the reader will start to get the new resource contents part-way through. This is because createKeyFileWithNoLock calls os.OpenFile with O_TRUNC set when updating a file, and the existing reader ends up pointing at the new data.

floren avatar May 04 '21 15:05 floren