How To Kill Zombie Processes on Linux

  • July 7, 2019

How To Kill Zombie Processes on Linux

What is a Zombie Process ?

Normally, When we launch a program, It starts their task & once task is over, Its end that process. Once process ended, It hos to be removed from the process table.

Sometimes, If programs are not programmed well enough to remove it’s child processes (Zombies). Because of this, some of these child zombie processes are reside in the process table even after it has completed its execution.

So, These process we called Zombie processes.

STEPS:

Run a Program >> Creates a Parent Process with Child Processes >> They utilize System's resources >> Complete Child Process Task >> Receive EXIT system call >> Die Child Process >> EXIT system call read by Parent >> Finally Child Process removed from Process table.

If Parent failed to read the EXIT system call from the child process, The child processes are already exists on the process table even though that child process are already dead.

Are they Harmful ?

No, But, If there are lot of Zombie process which will stored/collected in the RAM.

How To Find Zombie Processes ?

ps aux |grep Z

OR

ps aux |grep "defunct"

OR

ps -A -ostat,ppid | awk '/[zZ]/ && !a[$2]++ {print $2}'

How To Kill Zombie Process ?

kill -s SIGCHLD <PID OF PARENT>

OR

kill -9 $(ps -A -ostat,ppid | awk '/[zZ]/ && !a[$2]++ {print $2}')

Note: You Can Use This For Rsync Zombie Processes As Well.

Alternatively, You can use PKILL command like this way.

kill -9 $(ps -Z | grep "<PROCESS_EXACT_NAME>" | awk '{print $2}')

OR

pkill --signal --SIGCHLD rsync

Deploy Production Grade Kubernetes Cluster on Azure AKS

  • July 25, 2021

Introduction This tutorial is intended to demonstrate how to setup your 1st Kubernetes cluster on Azure Kubernetes Services (AKS). This tutorial will cover up all the steps that you need to setup complete AKS cluster.

Getting Started With Docker - Quick Start Guide

  • July 14, 2021

Getting Started With Docker - Quick Start Guide Docker Engine Platform as a Service (PaaS) Cloud platform service. Allows you to manage its application and data.

How To Run Microsoft SQL Server On Kubernetes - Azure Kubernetes Service

  • April 17, 2021

Prerequisites: Azure CLI https://docs.microsoft.com/en-us/cli/azure/install-azure-cli 1. Run the Azure CLI with the az command. 1.1 Run the login command. az login Login in the browser with the azure account.