Logging into my Linux server which hosts many Docker containers, I saw a warning that "There are 320 zombie processes." That seems bad! You can see which processes are involved using:
ps axo stat,ppid,pid,comm | grep -w defunct
They are all mongosh and that only comes from one of the docker containers running the MongoDB server. What is wrong here? And are these a problem?
The zombie processes exist because they were killed and some other process is still waiting for info from them. Not a big deal but probably unwanted.
My server is running via Docker Compose. In the compose file I had a health check which is using
mongoshto ping MongoDB internally. The timing of that was too short and it was being killed:Setting the
start_periodto10sand restarting the container fixed everything. Zombie apocalypse averted!