Consider simple setup of a child process. Basically, it is a producer(parent)-consumer(child) scenario.
class Job:
def start_process(self):
self.queue = multiprocessing.Queue(3)
self.process = multiprocessing.Process(target=run,
args=(self.queue))
def run(queue):
while True:
item = queue.get()
....
If I do kill -9
on the parent process the child will hang forever. I was sure that it will receive SIGHUP
like with subprocess.Popen
- when the python process quits the popen
ed will quit as well. Any idea how to fix child cleanup?