On Nov 26, 2012, at 11:05 AM, Richard Oudkerk <shibt...@gmail.com> wrote:

> Using CancelIo()/CancelIoEx() to abort an operation started with WSARecv() 
> does not seem to cause a problem

(emphasis mine)

Little command-line experiments are not the right way to verify the behavior of 
high-performance I/O APIs.  You need to do careful reading of the 
documentation, significant testing under load and experiments on a huge variety 
of platforms.  Windows runs in _lots_ of horrible, horrible places.

I think that the safest option would really be to better document the somewhat 
mangled state that a timeout may leave a socket in.  I don't believe the 
feature was intended for pipelined protocols; if you receive a timeout by using 
the stdlib timeout functionality you have generally burned the socket.

And, generally, things that care enough about performance or scalability enough 
to use IOCP operations should never use timeout-sockets anyway; it may do a 
select() internally (and on Windows, where poll() is never available, it _will_ 
do a select() internally), which limits the number of file descriptors you 
might even have in your process before you start encountering spurious errors.  
The use case it supports is when you have a little tool that just needs to 
fetch a URL or something really simple, but wants to be able to get on with 
things if that doesn't work or takes too long.

-glyph

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to