From b4324c1ec70a89d72bcb87747c1159b465234b78 Mon Sep 17 00:00:00 2001 From: David Recordon Date: Tue, 19 Jul 2011 19:12:28 -0700 Subject: [PATCH] Noticed that a max_clients around 50 would cause us to run out of file descriptors. lsof showed that TCP connections would remain in the established state versus being closed. stream.close is called in error states but not success. Thus call stream.close after passing the response to the callback. Result was seeing the TCP connections being properly closed as well as no change in fetching data. --- tornado/simple_httpclient.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index 759f460ad..71508e5c2 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -339,6 +339,7 @@ class _HTTPConnection(object): buffer=buffer, effective_url=self.request.url) self.callback(response) + self.stream.close() self.callback = None def _on_chunk_length(self, data): -- 2.47.2