Operating System - HP-UX
1833775 Members
3467 Online
110063 Solutions
New Discussion

running application directory removed

 
SOLVED
Go to solution
Shivkumar
Super Advisor

running application directory removed

Hi,

If an application is running and directory containing by it is removed by mistake by someone then will it become a zombie process ?

Thanks,
Shiv
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: running application directory removed

You can't remove it. Either you get text busy on the executable, or because that is your current directory.

Of course if that directory is on the server and the application is being run over NFS, you may be able to remove it. But you may get .nfs files that prevent the removal.
Shivkumar
Super Advisor

Re: running application directory removed

Are there anymore opinions on this ?

Thanks,
Shiv
James R. Ferguson
Acclaimed Contributor
Solution

Re: running application directory removed

Hi Shiv:

If you are referring to an inuse, executable file, then as Dennis has noted, you should not be able to remove the file. Trying to do so should return a "text busy" error for the file. Attempting to remove the directory housing the inuse, executable file should be denied, too, because (at least) one file in the directory can't be removed.

Removing a file or directory referenced by a a running process will not cause the process to become a zombie. At most, processes that do not already have files open will not be able to access the file(s) in question.

A zombie process is only a remanent of a child process that has terminated but for whom its parent process has not (yet) "reaped" ['wait()'ed] to collect the child's exit status.

Regards!

...JRF...
Matti_Kurkela
Honored Contributor

Re: running application directory removed

My answer would be: no, at least not directly.

The only way a process becomes a zombie is when the process terminates and its parent process does not read its child's result code (by calling wait() on the child's PID number).

As long as the application does not need to read anything from the removed files and the OS has no need to page in any code from the application binaries, the application can keep running just as before.

The OS will protect the application binary and the associated libraries from deletion, unless NFS is involved. With NFS, this protection cannot be absolute. If there is no way to page in data from the binary or the libraries whenever it's needed, the program will certainly crash.

Whenever you see zombie processes, look at the parent process (PPID) of the zombie: that process is not allowing the zombie to go its final rest, and needs to be fixed. The quick way to get rid of the zombies is to "kill that evil zombie master".

MK
MK