-
-
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
StaticRoute.sendfile incorrectly uses add_writer/remove_writer #958
Comments
Alright, so in the next asyncio release, using add_reader/add_writer on a socket that |
Fixed by #964 |
@1st1 could you point on source code change for the fix? I miss it. |
Aaah, it's not implemented still. |
See python/asyncio#372 for more details.
It seems that on modern OSes, aiohttp's implementation of sendfile always hits a fast path, i.e. first call to
os.sendfile
succeeds. On Mac OS 10.10, though, it sometimes does not, so the code callsadd_writer
on the underlying transport's socket.This is a wrong thing to do, as the status of the writer callback (and the active callback itself) is the private state of the transport. It also seems that
StaticRoute.sendfile
may not work at all whenadd_writer
is used.I suggest to duplicate the socket that
get_extra_info
returns before adding/removing readers/writers.The text was updated successfully, but these errors were encountered: