[New-bugs-announce] [issue22499] [SSL: BAD_WRITE_RETRY] bad write retry in _ssl.c:1636

Nikolaus Rath report at bugs.python.org
Fri Sep 26 03:24:30 CEST 2014

New submission from Nikolaus Rath:

I received a bugreport due to a crash when calling SSLObject.send(). The traceback ends with:

  File "/usr/local/lib/python3.4/dist-packages/dugong-3.2-py3.4.egg/dugong/__init__.py", line 584, in _co_send
    len_ = self._sock.send(buf)
  File "/usr/lib/python3.4/ssl.py", line 679, in send
    v = self._sslobj.write(data)
ssl.SSLError: [SSL: BAD_WRITE_RETRY] bad write retry (_ssl.c:1636)

At first I thought that this is an exception that my application should catch and handle. However, when trying to figure out what exactly BAD_WRITE_RETRY means I get the impression that the fault is actually in Python's _ssl.c. The only places where this error is returned by OpenSSL are ssl/s2_pkt.c:480 and ssl/s3_pkt.c:1179, and in each case the problem seems to be with the caller supplying an invalid buffer after an initial write request failed to complete due to non-blocking IO.

This does not seem to be something that could be caused by whatever Python code, so I think there is a problem in _ssl.c.

components: Library (Lib)
messages: 227582
nosy: alex, christian.heimes, dstufft, giampaolo.rodola, janssen, nikratio, pitrou
priority: normal
severity: normal
status: open
title: [SSL: BAD_WRITE_RETRY] bad write retry in _ssl.c:1636
type: crash
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list