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
asyncio: Windows Proactor Event Loop UDP Support #74069
Comments
I am working on a Python 3.5 project that uses asyncio on a Windows system to poll both UDP and TCP connections. Multiple sources online say that the Windows Proactor event loop, which uses I/O Completion Ports, is considerably faster and more efficient than the default Selector event loop. I'm using both UDP and TCP connections so I am stuck with the Selector event loop for the time being. I've seen the overhead of 128 open UDP/TCP connections on the Selector event loop to be near 85%, which I understand is entirely spent in Windows proprietary code and not the Python implementation. I'd like to take a shot at implementing UDP support in the IOCP event loop. It looks like there will be a considerable amount of code shared between TCP and UDP IOCP so I plan on implementing UDP support directly in _ProactorReadPipeTransport and _ProactorBaseWritePipeTransport. I should be able to do this by wrapping any TCP/UDP specific function calls in a check of: if sock.type == socket.SOCK_DGRAM:
# Do UDP stuff
elif sock.type == socket.SOCK_STREAM:
# Do TCP stuff My initial implementation plan is to:
My project is unfortunately tied to Python 3.5. So, if possible, I'd like to have UDP support merged into a v3.5 release. I can fork off of master instead of v3.5.3 if Python 3.5 support isn't an option. |
I just marked my old issue bpo-23295 as duplicate of this one. Copy of my messages: """ New functions should be added to the _overlapped modul. Example: add maybe WSARecvFrom()? See also https://code.google.com/p/tulip/issues/detail?id=187 |
Copy of my messages in July 2014: """ I'm working on a patch. I need to implement WSARecvFrom in the _overlapped module for example. ConnectEx() fails with an error 10022 when create_datagram_endpoint() is called with remote_address. A workaround is to replace "yield from sock_connect(sock, remote_address)" with "sock.connect(remote_address)". |
Adam Meily: Thanks for the proposed pull request. Would you mind to try to rebase it on the current master branch, please? |
I've rebased onto upstream master and I fixed the CI build. |
Could this be merged? UDP and pipes are critical for non-trivial asyncio programs on Windows, and this should be merged before the 3.8 feature window closes. |
I planned to ask you (Adam and Andrew) to merge the PR even if it's not finished, just to make sure that UDP support will land into Python 3.8. But Andrew finished the PR, yahoo! Thanks you very much Adam Meily and Andrew Svetlov! Sorry, I planned to do what Andrew did: "finish" the PR, but I was just too busy on other things :-( Well done, I see that you fixed max_size, pause/resume protocol, etc. asyncio on Windows will be much better experience with IOCP by default, CTRL+c support, UDP support, etc. |
You are welcome, Victor! Thank you very much, Adam! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: