[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 15:20:15 CEST 2011


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

Note: the only significant changes in the ssl module on branch 2.7 have been 742d73a99425 and 7f99ac53014a.

> Protecting my "reads" retrying when getting this exception does the
> trick, but now my code is convoluted and never before I had to manage
> this directly. This worked fine in 2.7.1. Previously Python seemed to
> do the retry itself.

I'm sure it didn't. I think you were just lucky that you had enough data to satisfy the read. With non-blocking code, by definition you have to be prepared to retry. That's especially true when using SSL, because having bytes available on the socket (as signalled by select()) doesn't mean there's anything to read on the SSL layer (for example, the bytes may not form a complete SSL frame).

----------

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


More information about the Python-bugs-list mailing list