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
dup_socket() on Windows should use WSA_FLAG_OVERLAPPED #58508
Comments
According to Microsoft's documentation sockets created using socket() have the If the source process uses the socket function to create the socket, the This means that dup_socket() in socketmodule.c should use return WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
FROM_PROTOCOL_INFO, &info, 0, WSA_FLAG_OVERLAPPED); instead of return WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
FROM_PROTOCOL_INFO, &info, 0, 0); (On Windows, the new multiprocessing.connection.wait() function depends on Patch attached. |
Which problem are you trying to solve? |
Are you sure this is desired? Nowhere can I think of a place in the stdlib where we use overlapped I/O on sockets. |
pitrou wrote:
multiprocessing.connection.wait() does overlapped zero length reads on sockets. It's documentation currently claims that it works with sockets. Also it would seem strange if some sockets (created with socket()) have the overlapped attribute, but some others (created with WSASocket()) don't. amaury.forgeotdarc wrote:
For one thing, the fact that socketmodule.c does not obey the word "must" in the quote from Microsoft's documentation.
An additional test could be added to test_multiprocessing.TestWait. Slightly surprisingly, in the testing I have done so far, using wait() with a duplicated socket seems to work without the patch. However, I would be rather wary of just assuming that it works in all cases and on all versions of Windows. |
New changeset 5be4d8fc9c44 by Antoine Pitrou in branch 'default': |
Ok, I've committed the patch to 3.3 since it can be useful with the new wait() method. Thanks! |
I already included this fix in my "socket share" patch, see bpo-14310. I think this was a bug that should be checked in to all relevant branches. The reason is this text from msdn documentation for WsaDuplicateSocket: See http://msdn.microsoft.com/en-us/library/windows/desktop/ms741565(v=vs.85).aspx |
Also, see this: http://support.microsoft.com/kb/179942/EN-US I have scoured the docs, but found yet no reason to _not_ use this attribute. I wonder why it is optional at all. |
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: