[issue12343] Python 2.7.2 regression: ssl.SSLError: [Errno 2] _ssl.c:503: The operation did not complete (read)

Antoine Pitrou report at bugs.python.org
Thu Jun 16 16:07:36 CEST 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> If now I can get a "retry" while writing, what is the logic?. Does
> Python retry automatically, internally?.

No, Python doesn't retry automatically. You have to call send() again with the same buffer.
(if Python retried, it would make non-blocking calls blocking)

Also, the args[0] of the SSL error tells you what the SSL layer is blocking on (SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE). 

Also, with the current setup, non-blocking write() will never succeed with a partial write. See issue12197.
(that doesn't mean nothing is written on the network, though. OpenSSL may start emitting bytes and keep track internally of what remains to be sent. The OpenSSL documentation isn't very clear on that, IIRC)

> I think SSL module documentation should write down this captchas when 
> using non-blocking sockets. That is, that read/write can raise
> exceptions even if "select" was OK.

Agreed.

Relatedly, there's issue10084 for SSL support in asyncore.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12343>
_______________________________________


More information about the Python-bugs-list mailing list