zombie process


 
Thread Tools Search this Thread
Operating Systems AIX zombie process
# 1  
Old 04-01-2010
zombie process

Is there an equivilant to the preap command in AIX that would allow me to get rid of a zombie process. I am new to AIX, moving over from Solaris and in the past I have been able to preap the pid on the defunct process to clean them up. I have looked around and the best I can see is that it may take a reboot to clean them up, so they may just need to sit there. Thanks in advance.
# 2  
Old 04-06-2010
You should be able to waitpid() for the process (that is not your own (child)) but I cannot verify this (without writing my own).

Another lame (probably not what you are looking for) response, but you should talk to the application vendor / developer and have them wait() from the process that launches the children. In short, it is an application problem.

---------- Post updated at 10:52 AM ---------- Previous update was at 09:54 AM ----------

I tried... I wrote an AIX preap app that called waitpid() on another processes children*. It bounced immediately (if using WNOHANG or not) (with a -1 return value) because the current process had "No child processes".

[*Source is available upon request - if you are interested.]

So... (as far as I can tell) AIX will not let you wait() for another processes (zombie) children. The correct response is to have the parent app call wait() - like it should. If that is not possible then bouncing the app (process group) should work, instead of the whole box.

I am not sure how Solaris does it... My version Solaris Internals does not yield a quick answer.

Last edited by wfavorite; 04-06-2010 at 10:56 AM.. Reason: Clarification, addition.
# 3  
Old 04-07-2010
Quote:
Originally Posted by wfavorite
[*Source is available upon request - if you are interested.]
Many thanks for your contribution. If you could provide a (maybe stripped down to the point) source here we would all gain from your insight. The board is guaranteed to be able to cope with it.

bakunin
# 4  
Old 04-07-2010
I wrote two apps to test this... preap and badkids. badkids spawns three zombies and stays alive so they are not reaped by the shell or init. (Technically I think init does the reaping.) badkids should print the PID of the zombie children but does not - so you have to do a ps to get the PIDs. (This would be trivial as it does print its own PID on startup.)

preap looks for a PID parameter on start and passes that to waitpid(). waitpid() currently uses no options but was originally written with WNOHANG. (I think I spelled that right - the docs are in the wait() InfoCenter page.) The status value (passed by reference to waitpid()) is filled with the exit info of the child process. The exit info is encoded to hold more than one piece of info, so I call the WEXITSTATUS() macro to find just the exit value.

But, in short, a program must call a wait() variant *every* time a fork() call is made. This does not mean that it must be called immediately, but it must be called or those process zombies will result. Unix provides multiple different versions of wait() - blocking, non-blocking, wait-for-your-gid, etc... that can be used to reap the children however is best.

As for the code... I do not intend to keep it up forever so I am presenting a "fragmented" URL that will not be indexed. (You have to put the pieces together to grab it.) It will be up for a month or so. (today's date is 4/7/10)

http://www.tablespace.net
/samples/preap-0_1_0.tar.gz

Note on building: will use the AIX supplied make or g(NU)make, but is written for gcc. I have not tried, but see no reason it would not compile on Linux, OS-X, Solaris, etc... (Just tried it on OS-X, it compiled fine.)

This code is free to distribute, re-use, re-post, or line the floor of your home directory. Although, I would make it more robust before re-use - this is just sample, as opposed to production code.

Last edited by wfavorite; 04-07-2010 at 07:55 AM.. Reason: The URL got auto-mucked up. Fixed it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Zombie process

What is the overhead associated with zombie process?Is it running out of process-ID?:confused: Since some information is stored in process table.. Thanks in Advance (4 Replies)
Discussion started by: jois
4 Replies

2. UNIX for Dummies Questions & Answers

Zombie process question

Hey guys, So i did some research on the site but previous posts answered most of my questions about zombie processes but I have one question that didnt seem to get addressed "how do you find the parent or parent ID of a zombie process so you can kill it?" I know p -kill doesnt always just... (6 Replies)
Discussion started by: kingpin007
6 Replies

3. Solaris

How to Kill Zombie Process

Dear Bos, I have one server,everday if I check with command TOP always present zombie,like below: last pid: 4578; load averages: 0.15, 0.11, 0.13 07:56:15 298 processes: 295 sleeping, 1... (10 Replies)
Discussion started by: fredginting
10 Replies

4. Solaris

zombie process

dear friends, in an interview they asked me what is zombie process. how we can identifying these process.if can you kill all zombie process. (8 Replies)
Discussion started by: sijocg
8 Replies

5. Shell Programming and Scripting

Zombie process

Hi I need help because I don't know if it is possible to add a find inside a cat. like I have a file with the pid of the process that use to became zombie. And I have the same pid stored in the var (pid1) now, I have no clue how to check if the the find finds the pid or even if it's... (2 Replies)
Discussion started by: ruben.rodrigues
2 Replies

6. Linux

How to kill zombie process

I have RHES4 machine with VRTSralus - Backup Exec agent installed there and running as a service. The agent hiccups sometimes and turns into defunct state. The problem is that I cannot kill it anyway., it stays there forever until the machine is rebooted. I wonder if anyone had such an experience... (1 Reply)
Discussion started by: will_mike
1 Replies

7. Linux

zombie process

Hi What is the command to find only the zombie processes?? How to write the code in C to fetch the no. of zombie processes?? Thanx (5 Replies)
Discussion started by: jeenat
5 Replies

8. Programming

how to handle a zombie process

hi! i am writing a c program which has the following structure: main() { child1 child1.1 child2 child2.1 } the child1.1 and 2.1 are becoming zombies... how can i handle this... thanx (1 Reply)
Discussion started by: mridula
1 Replies

9. UNIX for Advanced & Expert Users

Zombie process

I would like to create a zombie process so that I can test monitoring software functionality. Any techniques? (2 Replies)
Discussion started by: swhitney
2 Replies

10. UNIX for Dummies Questions & Answers

Zombie process

How do i kill a zombie process. Is it that only root can kill a zombie process. (8 Replies)
Discussion started by: orca
8 Replies
Login or Register to Ask a Question