[Twisted-Python] HTTP Agent persistent connections not closed for some HTTPS sites

Tristan Seligmann mithrandi at mithrandi.net
Sun Mar 5 07:25:01 MST 2017


On Sun, 5 Mar 2017 at 15:36 Adi Roiban <adi at roiban.ro> wrote:

> I have observed this while running some end to end tests in which the
> pool.closeCachedConnections() deferred was not called, even after a
> generous amount of seconds :)
>

The code to abort an HTTP client connection is here:

https://github.com/twisted/twisted/blob/twisted-17.1.0/src/twisted/web/_newclient.py#L1657

This calls loseConnection which for a TLS connection will try to do a TLS
shutdown under most circumstances (in some cases it can't, and will
abortConnection on the underlying transport instead). If the remote end has
stopped responding to the connection, I think this may end up hanging
forever.

I think this code should either call abortConnection directly, or set a
timer which will abort the connection after a little while if a clean
shutdown from loseConnection has not completed yet. I'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20170305/d0581d6e/attachment-0002.html>


More information about the Twisted-Python mailing list