I'm using multiprocessing python lib.
I create new Process and executing my job.
After finishing job, I just call exit(0), but process is 'defunct' state.
I try to kill as 'kill -9 PID', 'kill -18 PID' and etc, but I can't kill child process with keep parent process live.
How should I do? This is my python code
'process.py'
def process(data, id):
while isWorking:
#work process and change isWorking to False
process = Process(target=process, args=(data,id))
process.start()
it's my process list (ps -al)
0 S 1001 19295 19291 0 80 0 - 45817 poll_s pts/3 00:00:09 python3
1 Z 1001 19339 19295 3 80 0 - 0 - pts/3 00:00:58 pyth <defunct>
I want to keep live parent process(19295) and kill child defunct process 19339.
How should I doe?