[Twisted-Python] TB in tls.py
![](https://secure.gravatar.com/avatar/cf223b7cf77583c0a2665bad01f84f11.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Jun 26, 2019, at 8:14 AM, Scott, Barry <barry.scott@forcepoint.com> wrote:
I'm see this TB often and I'm wondering how to fix it.
Looks like there's already been some investigation / discussion of this issue :-). https://twistedmatrix.com/trac/ticket/9462 <https://twistedmatrix.com/trac/ticket/9462> Possibly illuminating to review this, and the linked tickets? -glyph
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Jun 26, 2019, at 8:14 AM, Scott, Barry <barry.scott@forcepoint.com> wrote:
I'm see this TB often and I'm wondering how to fix it.
Looks like there's already been some investigation / discussion of this issue :-). https://twistedmatrix.com/trac/ticket/9462 <https://twistedmatrix.com/trac/ticket/9462> Possibly illuminating to review this, and the linked tickets? -glyph
participants (2)
-
Glyph
-
Scott, Barry