I have some problems with Python child processes, so I wrote a very simple script:
import os import sys import time pid = os.fork() if pid: #parent time.sleep(30) else: #child #os._exit(0) sys.exit()
While the parent process is sleeping, I run
ps fax | grep py[t]hon
And I read this conclusion
2577 ? S 0:00 python /home/pi/python/GPIO/GPIODaemon.py restart 2583 ? Z 0:00 \_ [python] <defunct>
Using sys.exit() or os._exit(0) , there is always a Zombie process, and I cannot understand why.
While working on my more complex code, I thought there were some resources that the child processes kept blocked, but there was no file / socket / db connection at all on this simplified root code! Why is the baby process zombie?
source share