Linux – How to a zombie process hold system resources like a TCP port

linuxprocesstcp

How can my zombie process (PID 5693 in the example) hold resources like a TCP port (port 21050 in the example, but in my actual case it holds a lot more, like pty and other file descriptors)? And how can I release the TCP port without a reboot? I even do not understand how a process can be in such a state (I mean, being a zombie AND still holding resources).

[root@mycomputer ~]# ps -fe | grep 5693
user      5693     1   0 Apr03 ?        00:01:12 [myproc] <defunct>
user      5835  5693   0 Apr03 ?        00:00:00 [mysubproc] <defunct>
root      58888 58050  0 17:39 pts/1    00:00:00 grep 5693
[root@mycomputer ~]# lsof | grep  21050
Systemtas 5693        user   15u     IPv4            3853742       0t0        TCP *:21050 (LISTEN)
[root@mycomputer ~]#

Best Answer

A Zombie process is a dummy entry in the system process table, only waiting for its parent process to ask for and receive the news of its demise. It can only briefly hold resources until the system finishes freeing them all.

However, there is a catch with TCP : This could take a few minutes during which the TCP port is being held alive for the process at the other end to be able to possibly receive any last data sent by the defunct process.

This waiting time is usually a modifiable parameter in the operating system.

Related Question