From 4dbbe180211d65e48aeac8bf65b27600d4f51eca Mon Sep 17 00:00:00 2001 From: ianb Date: Thu, 26 Apr 2007 21:50:27 +0000 Subject: Fix the way max_requests works, so that we don't think the idle worker thread is still around (which caused the *real* worker threads to be culled, leaving only ghost workers who don't actually do any work, and thus the server would freeze) --- paste/httpserver.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'paste/httpserver.py') diff --git a/paste/httpserver.py b/paste/httpserver.py index 299f9a8..319bc07 100755 --- a/paste/httpserver.py +++ b/paste/httpserver.py @@ -831,8 +831,14 @@ class ThreadPool(object): while True: if self.max_requests and self.max_requests < requests_processed: # Replace this thread then die + self.logger.debug('Thread %s processed %i requests (limit %s); stopping thread' + % (thread_id, requests_processed, self.max_requests)) + try: + self.idle_workers.remove(thread_id) + except ValueError: + pass self.add_worker_thread() - break + return runnable = self.queue.get() if runnable is ThreadPool.SHUTDOWN: self.logger.debug('Worker %s asked to SHUTDOWN', thread_id) -- cgit v1.2.1