[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-04-01 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

I already included this fix in my socket share patch, see issue 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:
 Both the source process and the destination process should pass the same 
flags to their respective WSASocket function calls. If the source process uses 
the socket function to create the socket, the destination process _must_ 
[underline KVJ] pass the WSA_FLAG_OVERLAPPED flag to its WSASocket function 
call.

See 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms741565(v=vs.85).aspx

--
nosy: +krisvale

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-04-01 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Also, see this: http://support.microsoft.com/kb/179942/EN-US
applies to windows 2000 only, as far as I can tell, though.  Don't know if we 
still support that.

I have scoured the docs, but found yet no reason to _not_ use this attribute.  
I wonder why it is optional at all.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-03-31 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 5be4d8fc9c44 by Antoine Pitrou in branch 'default':
Issue #14300: Under Windows, sockets created using socket.dup() now allow 
overlapped I/O.
http://hg.python.org/cpython/rev/5be4d8fc9c44

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-03-31 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, I've committed the patch to 3.3 since it can be useful with the new wait() 
method. Thanks!

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-03-14 Thread sbt

New submission from sbt shibt...@gmail.com:

According to Microsoft's documentation sockets created using socket() have the
overlapped attribute, but sockets created with WSASocket() do not unless you 
pass the WSA_FLAG_OVERLAPPED flag.  The documentation for WSADuplicateSocket()
says

  If the source process uses the socket function to create the socket, the 
  destination process must pass the WSA_FLAG_OVERLAPPED flag to its WSASocket 
  function call.

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
the overlapped attribute, although it is primarily intended for use with pipe 
connections not sockets.)

Patch attached.

--
files: socket_dup.patch
keywords: patch
messages: 155748
nosy: sbt
priority: normal
severity: normal
status: open
title: dup_socket() on Windows should use WSA_FLAG_OVERLAPPED
versions: Python 3.3
Added file: http://bugs.python.org/file24841/socket_dup.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-03-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Which problem are you trying to solve?
Can this change be tested somehow?

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-03-14 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Are you sure this is desired? Nowhere can I think of a place in the stdlib 
where we use overlapped I/O on sockets.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

2012-03-14 Thread sbt

sbt shibt...@gmail.com added the comment:

pitrou wrote:
 Are you sure this is desired? Nowhere can I think of a place in the
 stdlib where we use overlapped I/O on sockets.

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:
 Which problem are you trying to solve?

For one thing, the fact that socketmodule.c does not obey the word must in 
the quote from Microsoft's documentation.

 Can this change be tested somehow?

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.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com