[Twisted-Python] TB in tls.py
Scott, Barry
barry.scott at forcepoint.com
Wed Jun 26 09:14:46 MDT 2019
I'm see this TB often and I'm wondering how to fix it.
File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line
902, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/usr/local/lib/python2.7/site-packages/twisted/web/http.py", line
2333, in forceAbortClient
self.transport.abortConnection()
File "/usr/local/lib/python2.7/site-packages/twisted/protocols/tls.py", line
435, in abortConnection
self._shutdownTLS()
File "/usr/local/lib/python2.7/site-packages/twisted/protocols/tls.py", line
338, in _shutdownTLS
shutdownSuccess = self._tlsConnection.shutdown()
exceptions.AttributeError: 'NoneType' object has no attribute 'shutdown'
I can see in TLSMemoryBIOProtocol.connectionLost that _tlsConnection
is set to None. Which I think is racing with the call later that calls
forceAbortClient().
If that is the case then I think this is a possible fix?
Thoughts?
--- twisted-upstream/src/twisted/protocols/tls.py 2019-06-26
16:10:54.329822916 +0100
+++ _diff_.tmp 2019-06-26 16:12:17.992418082 +0100
@@ -334,7 +334,7 @@
Initiate, or reply to, the shutdown handshake of the TLS layer.
"""
try:
- shutdownSuccess = self._tlsConnection.shutdown()
+ shutdownSuccess = self._tlsConnection is not None and
self._tlsConnection.shutdown()
except Error:
# Mid-handshake, a call to shutdown() can result in a
# WantWantReadError, or rather an SSL_ERR_WANT_READ; but
pyOpenSSL
Barry
More information about the Twisted-Python
mailing list