Issues

Issue #99 resolved

bug in threadpool 1.2.7

Leelour Zhu
created an issue

I just found that the thread pool becomes unstable when the pool size becomes bigger. It will raise a lot of exceptions like
"
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 808, in __bootstrap_inner
File "/Library/Python/2.7/site-packages/threadpool.py", line 148, in run <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'
"
I spend some time to look into the source code and find bugs in threadpool.ThreadPool.wait() method.

Here is the bug description: When there is no requests in self.workRequest, there are still some workers 'is_active' (blocked by Queue.Queue.get). We need to dismiss all of these threads, otherwise, these threads will not be properly handled

so I add a line of code after line
326 except NoResultsPending:
here is the code that I added
self.dismissWorkers(num_workers = len(self.workers), do_join=True)

After I add this line of code, the exception disappear.

I do not know whether I should submit this bug here. If it is not proper to discuss this problem here, :-) my apology.
And I wonder where I can submit this bug (I find no way to contact the author).
And if anyone have an elegant way to solve the problem, please let me know! Thanks!

Comments (3)

  1. Log in to comment