Skip to content
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

Closed
1st1 opened this issue Jul 5, 2016 · 5 comments
Closed

StaticRoute.sendfile incorrectly uses add_writer/remove_writer #958

1st1 opened this issue Jul 5, 2016 · 5 comments
Labels

Comments

@1st1
Copy link
Contributor

1st1 commented Jul 5, 2016

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 calls add_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 when add_writer is used.

I suggest to duplicate the socket that get_extra_info returns before adding/removing readers/writers.

@1st1
Copy link
Contributor Author

1st1 commented Jul 5, 2016

Alright, so in the next asyncio release, using add_reader/add_writer on a socket that transport.get_extra_info('socket') returns will be an error. I'll also fix uvloop to do that too. This issue has to be fixed asap.

@asvetlov
Copy link
Member

Fixed by #964

@asvetlov
Copy link
Member

Alright, so in the next asyncio release, using add_reader/add_writer on a socket that transport.get_extra_info('socket') returns will be an error.

@1st1 could you point on source code change for the fix? I miss it.

@asvetlov
Copy link
Member

Aaah, it's not implemented still.

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants