Thread limitations and SocketServer?
sblakey at freei.net
sblakey at freei.net
Tue Mar 21 16:04:03 EST 2000
I am running a SocketServer on a Linux box (/prov/version is
Linux version 2.2.13 (root at ooc3) (gcc version egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)) #2 SMP Wed Dec 29 07:57:42 PST 1999) and am
running into a thread-related problem.
Once this server is hit with a heavy enough load, the following
traceback begins to appear with alarming frequencey:
Traceback (innermost last):
File "/usr/lib/python1.5/SocketServer.py", line 213, in handle_request
self.process_request(request, client_address)
File "/usr/lib/python1.5/SocketServer.py", line 321, in process_request
(request, client_address))
error: can't start new thread
The offending section of the SocketServer module seems innocuous enough:
def process_request(self, request, client_address):
"""Start a new thread to process the request."""
import thread
thread.start_new_thread(self.finish_request,
(request, client_address))
Obviously some internal limitation on the number of concurrent threads
is being reached. My question is: is this problwm solvable within
python? Is this a limitation of the python thread implementatio, or
will I need to dive down deeper to the underlying pthreads? Will I
have the same problem if I rework the server to use asyncore instead of
SocketServer?
More information about the Python-list
mailing list