I have a simple server:
from multiprocessing import Pool, TimeoutError import time import os if __name__ == '__main__':
If I run this, I will get something like:
47292 47292
Then I kill 47292 while the server is running. A new workflow starts, but server output:
47292 47292 worker timed out worker timed out worker timed out
The pool is still trying to send requests to the old workflow.
I have done some work with search signals both on the server and on the workers, and I can improve the behavior a bit, but the server still seems to wait for dead children at the end of the work (i.e. pool.join () never ends) after the worker is killed.
How can one die with workers?
The graceful shutdown of workers from the server process seems to work if none of the workers died.
(On Python 3.4.4, but will be happy to update if this helps.)
UPDATE: Interestingly, this working time error does not occur if the pool is created using processes = 2, and you kill one worker process, wait a few seconds and kill another. However, if you kill both workflows in quick succession, then the work timeout problem reappears.
Perhaps this is due to the fact that if a problem occurs, the destruction of the server process will lead to the launch of work processes.