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, doing fstat
to get the stat
To Reproduce
replace the file on the FS between the stat
and open
call
Expected behavior
The handler should still send the original file
Logs/tracebacks
Python Version
aiohttp Version
$ python -m pip show aiohttp
multidict Version
$ python -m pip show multidict
yarl Version
$ python -m pip show yarl
OS
n/a
Related component
Server
Additional context
n/a
Code of Conduct