Problem with threading: can't start new thread
sufrank
franks at outblaze.com
Wed Mar 11 03:54:37 EDT 2009
I am doing stress test with python using threading, I have encountered
the can't start new thread problem when running the script.
The system is Linux, python version 2.4
Traceback (most recent call last):
File "./imap_test.py", line 38, in ?
current.start()
File "/usr/lib/python2.4/threading.py", line 416, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can't start new thread
Part of my testing scripts(python) is as followed:
#!/usr/bin/python
import const;
import imap_pattern;
import os
import re
import time
import sys
from threading import Thread
import logging
Userno_Max = 1000
class client(Thread):
def __init__ (self,ID,type,username):
Thread.__init__(self)
self.username = username
self.type = type
self.ID = ID
def run(self):
print self.ID
myTest = imap_pattern.imap_pattern(self.ID)
myTest.run_pattern(self.type,self.username)
if __name__ == '__main__':
print time.ctime()
Users = int(sys.argv[1])
Period = float(sys.argv[2])
id = 1
for host in range(0,1000):
username = "%s%d@%s" %(const.Username_Prefix, id % Userno_Max,
const.Domain)
current = client(id,1,username)
current.start()
id += 1
More information about the Python-list
mailing list