I have some threads that queue for work, something like this:
class Worker(Thread): [...] def run(self): while not self.terminated: job = myQueue.get_nowait() job.dosomething() sleep(0.5)
Now self.terminated is just the bool value that I use to exit the loop, but this is a problem, they stop working several times a day without my intervention. All of them, except for one: the application starts with, say, 5 workflows and at any time I check them, and one only works. All others have both _Thread__initialized and _Thread__stopped fields true. Threads and tasks do not interact with each other. What should I look for?
PS: I understand that it is very difficult to try to figure out the problem without the actual code, but it is huge.
UPDATE: in fact, Queue.Empty is the only exception to the trap - I think I believed that all internal job errors propagate without destroying eheh threads - so I'm going to block all exceptions and see ...
source share