-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: StaticRoute returning old file contents #628
Comments
I suspect you've caught filesystem desynchronization effect between Docker, Vagrant and Windows. |
If you're talking about a delay of ~20mins, you might be right. I got the files to refresh once, but when it happened again, I investigated further. The files are fine if I "cat" them in the Docker container. This is obviously for development :). I would not use aiohttp to serve static files in production. And that makes it an even more important bug, because files while developing change so frequently. |
Sounds bad. |
Mhhh...this is an odd bug. |
@jashandeep-sohi , no, it still serves the old file. |
My guess what's happening: after saving a file, a new file may be created, but the old file handle still kept open by some process. When requesting the file handle ID, the old file handle ID is returned and the old file contents are served. This is just a guess. I am not an expert on Linux system internals. |
That's what I was thinking too, but I don't think Python caches the file object returned by But it seems the problem even affects |
It cannot be aiohttp or python issue because the code always open new file Thus we have 2 options:
|
@asvetlov I propose |
Environment variable sounds good but I'm inclining to AIOHTTP_NOSENDFILE=x |
Yea, that's better. |
@jashandeep-sohi would you provide a patch? |
@asvetlov Yea, tomorrow. BTW, apparently this is a well known bug for VirtualBox, with the recommended "fix" being "turning off sendfile". I wouldn't call that "fix". |
Yes, it's not a fix but workaround for virtualbox bug |
Fixed by #629 |
I am running aiohttp in an Ubuntu Docker container within a Vagrant (VirtualBox) CentOS 7 VM within Windows 8.1. The static files are served from a mounted directory in the CentOS VM, which is again a synced folder to a Windows directory.
This setup causes old file contents to be served even though the date-modified and content-length headers are correct.
The immediate fix is not to use add_static on the router, but do this:
Bug is present in v0.18.3, but I'm not sure which part of my setup is to blame.
The text was updated successfully, but these errors were encountered: