Closed xiaoxinmiao closed 2 years ago
You're probably running into a race condition caused by the combination of Python and the operating system, I don't think I can fix this in aiofiles. I would suggest using a lock (or a semaphore with a value of 1) to mitigate the issue.
@Tinche ok,by the way, is it reliable to run on linux and macOs
Inaccurate results on
windows
whenmode=a
is set and Semaphore is 2Environment:
system:
windows
aiofiles version:0.8.0
Test
test1:
sem = asyncio.Semaphore(2)
When the parameter is passed in 1, the result is correct When the parameter is passed in 2, the result is incorrecttest2
Wrong result on windows, correct result on linux
Source
Result
The result of running on windows when setting Semaphore to 2
expect data
actual data