Ticket #58 (new defect)

Opened 1 year ago

Last modified 1 year ago

flup.server.threadpool.ThreadPool starts too many threads initially

Reported by: trac Assigned to: asaddi
Priority: minor Milestone: flup.server-1.0.3
Component: flup.server Version: 1.0.2
Keywords: thread minSpare Cc:

Description

flup.server.threadpool.ThreadPool? starts maxSpare threads instead of minSpare threads as I would expect and as the comment in init() implies. (At line 48 in 1.0.2 source.)

Change History

11/19/10 03:16:21 changed by trac

This can also mean that more than self._maxThreads are started initially. (Surprisingly this doesn't seem to cause any of the asserts to go off!)

11/19/10 16:27:10 changed by asaddi

Looking into this. Although, like preforkserver.py, the contract (that I set up) is that the number of idle threads would always be between minSpare and maxSpare inclusive. (And of course, the total number of threads must never be higher than maxThreads.) Nothing else is stated or implied.

So starting maxSpare threads right away still technically correct -- it's just a bit optimistic.

But this behavior has caused confusion on the forking side as well, so I will look into it more when I have time.