Ways to eliminate Zombies?


 
Thread Tools Search this Thread
Top Forums Programming Ways to eliminate Zombies?
# 1  
Old 11-28-2009
Ways to eliminate Zombies?

what are the precautions to be taken care for avoiding zombie process ?
# 2  
Old 11-28-2009
... don't kill a parent before its children processes are gone

Kind regards
zxmaus
# 3  
Old 11-28-2009
let me explain my requirement.

1) i have a daemon running , which invokes dhcpcd, when dhcpcd is invoked it waits for ip address untill it get an ip address, once it gets an ip address it spawns dhcpcd daemon and dies.

if i use waitpid() ,if dhcpcd is able to get ip addresss it is fine
but when dhcpcd failed to get ip address it is hanging for the dhcpcd to get complete its task.But practically the process should not hang

if i use waitpid with no hang, some times it is creating zombie process.

is there any signals to get registered, like when the signal get triggered , let me clean up the child info. how to keep track of the child with out blocking
any suggestion

please do the needful
# 4  
Old 11-28-2009
You could catch SIGCHLD. When a child process closes, you get it, meanwhile, you can do whatever else you want.
# 5  
Old 11-29-2009
1) Which one is daemon - dhcp ? I guess you meant it like crond spawning an instance ( self instance ) and arbitrating for the current job - something like that ...
so in that case, the instance that is waiting isnt that self timed out if its not able to get ip address - am not sure of the requirement, so possibly it could be that dhcp instance might have to wait indefinitely in that case it wont return with " cannot find address "

2) Another stuff is to ignore SIGCHLD - in which case zombie creation can be controlled, if there is requirement to decide / update child exit stats by the parent, then this is not a good option
# 6  
Old 11-29-2009
would some one please clarify , what will happen once a parent process receives a SIGCHLD .
if parent process catches SIGCHLD would it clears the child's process context and eliminate zombie.

or do we have to explicitly take care of clearing the child's process context
in the handler ?
# 7  
Old 11-29-2009
call wait() from the SIGCHLD handler to handle the termination of the child process.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help! Zombies

Hello, quick question: I have a zombie process listed with 'top' Could someone help me find out what it the PID is for it, so I can kill $PID. $ model 9000/800/rp3440 HP-UX bigassserver B.11.31 U 9000/800 3085785128 unlimited-user license thanks! System: bigassserver ... (23 Replies)
Discussion started by: olyanderson
23 Replies

2. Shell Programming and Scripting

Need help to eliminate the records

Hi All, Please help me how to remove the records from the file if it is having more number of fields than the required one, before loading into stage Here is the sample records. File is space delimited one chandu 1121324 CC ( 2 spaces) chandu balu 434657 DD (3 spaces) -- failing due to... (10 Replies)
Discussion started by: bbc17484
10 Replies

3. Shell Programming and Scripting

How to eliminate ^L

Hi, I am trying to create a text file from data retrieved from a query.The data retrieved is having this character '^L' at regular intervals of the data. How can i eliminate this, Please find below the sample data. I tried sed -e "s/\^L//g" to convert it, but with no luck ^LCODE*SERIAL... (11 Replies)
Discussion started by: ramkiran77
11 Replies

4. Shell Programming and Scripting

Compare and eliminate

Could any one help me to compare the date value say at 10th column with sysdate (i.e current date) and if diffrence is more than 50 days then filter them out from the file. The file contain 10000 records. head file 00971502657744 A671FAHP2EW8BG1369172011HRWS contact information ... (6 Replies)
Discussion started by: zooby
6 Replies

5. Shell Programming and Scripting

How to eliminate < > sign meaning

Hi I would like to replace one of our script, and add some pre-checking for the input file before running the command, but I bumped into the following issue: Original command: use < input.txt I cannot modify the original command, but I created the useit script which would be called as... (2 Replies)
Discussion started by: apapp
2 Replies

6. UNIX for Dummies Questions & Answers

Zombies

I had a problem deleting a zombie process. It refused to be killed. I even tried kill -9 process# but it refused. Any other way of killing it? (7 Replies)
Discussion started by: victorn
7 Replies

7. Programming

FreeBSD, fork() and zombies

i'm writing small http proxy server (accept client -> connect to remote proxy server -> recv client's request -> send to remote proxy server -> get responce from remote proxy server -> send answer to client -> close connection to client and to remote proxy server) and having problems with fork().... (2 Replies)
Discussion started by: PsycoMan
2 Replies

8. HP-UX

How can i kill Zombies

Hi All I need help, how can i kill zombies instead of rebooting the system. Regards System: sna Tue Apr 5 17:50:23 2005 Load averages: 0.05, 0.15, 0.22 168 processes: 157 sleeping, 5 running, 6 zombies Cpu states: CPU LOAD USER NICE... (5 Replies)
Discussion started by: cgege
5 Replies

9. UNIX for Dummies Questions & Answers

No zombies!

Is there a command that will automaticaly go through and kill all children when you try to kill the parent process. Thanks, David (3 Replies)
Discussion started by: nucca
3 Replies

10. UNIX for Dummies Questions & Answers

Zombies

Okay, I'm working within ansi C and Sun Solaris 7. I have a problem with zombies. I'm currently using the kill command to return the status of a process. How do I check for Zombie PIDs or the right function to return its PID from within a C program? (1 Reply)
Discussion started by: karpolu
1 Replies
Login or Register to Ask a Question