summaryrefslogtreecommitdiff
path: root/paste/httpserver.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2007-04-26 21:50:27 +0000
committerianb <devnull@localhost>2007-04-26 21:50:27 +0000
commit4dbbe180211d65e48aeac8bf65b27600d4f51eca (patch)
treeae4a323b84367f12f45933f8914b5f1f1c45f9f0 /paste/httpserver.py
parentc8ffad214399cefc4f9544433068c5f72f3a9f02 (diff)
downloadpaste-4dbbe180211d65e48aeac8bf65b27600d4f51eca.tar.gz
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)
Diffstat (limited to 'paste/httpserver.py')
-rwxr-xr-xpaste/httpserver.py8
1 files changed, 7 insertions, 1 deletions
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)