FileResponse
has undefined behavior if the file is changed out from under it between the stat
and open
calls
#8013
Labels
This was discovered while fixing another issue in #8012 (comment)
This is a rare case so its not likely we need to prioritize fixing it but I'm sure this race has bitten someone with random unexplained failures who uses aiohttp to serve index or signature files that get changed out frequently.
Describe the bug
We can fix this by
open
ing the file first, doingfstat
to get thestat
To Reproduce
replace the file on the FS between the
stat
andopen
callExpected behavior
The handler should still send the original file
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
n/a
Related component
Server
Additional context
n/a
Code of Conduct
The text was updated successfully, but these errors were encountered: