Hi all,
I have handeled the SIGCHLD using waitpid as,
void sigchld_handler(int s)
{
int pid, status = 0;
while((pid = waitpid(-1, &status, WNOHANG)) > 0){
if(WIFSIGNALED(status)) {
fprintf(stdout, "kid: %d terminated with status: %d\n",
pid, status);
}
fprintf(stdout, "Kid exit status: %d\n", pid);
}
}
The same handler is used every where for handling kids reaping.
Waitpid will reap all the process that have died when its called.
In one program, when several processes exit together I see zombies
getting created and getting reaped, so that is perfectly fine.
But in another program, I see only zombie process. This processes
accepts connection on socket and give the data to the parent which
then writes it on to mysql server using mysql client library.
Any guesses wht's going wrong.
|
|
0
|
|
|
|
Reply
|
pradeep
|
3/3/2005 4:57:31 AM |
|
"Pradeep" <pradeep@mauj.com> wrote in message
news:3ffc09d1.0503022057.1de4280e@posting.google.com...
> Hi all,
>
> I have handeled the SIGCHLD using waitpid as,
>
> void sigchld_handler(int s)
> {
> int pid, status = 0;
> while((pid = waitpid(-1, &status, WNOHANG)) > 0){
> if(WIFSIGNALED(status)) {
> fprintf(stdout, "kid: %d terminated with status: %d\n",
> pid, status);
> }
> fprintf(stdout, "Kid exit status: %d\n", pid);
> }
> }
>
> The same handler is used every where for handling kids reaping.
> Waitpid will reap all the process that have died when its called.
>
> In one program, when several processes exit together I see zombies
> getting created and getting reaped, so that is perfectly fine.
>
> But in another program, I see only zombie process. This processes
> accepts connection on socket and give the data to the parent which
> then writes it on to mysql server using mysql client library.
>
> Any guesses wht's going wrong.
waitpid() can return -1 for reasons other than ECHILD. One of these reasons
is EINTR. You need to examine errno after a -1 return and decide whether or
not to re-enter waitpid().
--
Fletcher Glenn
|
|
0
|
|
|
|
Reply
|
Fletcher
|
3/3/2005 5:32:57 PM
|
|
|
1 Replies
175 Views
(page loaded in 0.047 seconds)
Similiar Articles: SIGCHLD, fork() and sleep() - comp.unix.programmerIf i quickly fork children processes and quickly exit then after the children have terminated and parent is sleep()ing I see a single Zombie process. unkillable processes causes? - comp.unix.solarisPs won't (at least in older versions) > correctly identify "zombie" processes as such. I think "top" will, > if you have it. I'm unaware of any recent version of 'ps ... Is there a way to modify the environment of a running process in ...Hello. Is there any way to change environment variable of a running process? Ex. attaching a process to mdb and then changing some variables? What I... Determine number of open files and/or open file locks - comp.sys ...... Jones wrote: >> i believe there was disucssion some time back about a bug that left >> zombie zombies around keepin gthe proc table full, > top showed no zombie processes ... how to terminate a child process properly - comp.unix.programmer ...I think you need to read the FAQ entry on "zombie" processes. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly ... How to get status for process - comp.unix.solarisI have known the process's pid, now I want to know whether the process is an zombie process. how to using C/C++? is there any APIs to use ? I am using how to kill all child when parent exits - comp.unix.programmer ...> > POSIX says that when a process terminates: > > The parent process ID of all of the existing child processes and > zombie processes of the calling process shall ... fork(): how can I kill forked process and all ITS children, but ...Kill Child Process - C / C++ Since I dont wish to leave any zombie process, I ... process when kill the parent process; fork(): how can I kill forked process and all ITS ... Can we get 64 bit process' memory info with application running in ...Hi, We've a module that fetches the process information of specific ... lwps in the process */ int pr_nzomb; /* number of zombie lwps in the process ... Annoying kernel memory leak in U6? - comp.unix.solaris... grabbed a "top" output at 07:19: >> >>> last pid: 9719; load avg: 175.7, 150.8, 64.7; up 1+20:51:41 07:19:48 >>> 101 processes: 98 sleeping, 1 zombie, 2 on cpu ... Zombie process - Wikipedia, the free encyclopediaOn Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process ... What is a Zombie Process? « Zombie ProcessInterestingly, it seems that many search engines want to provide my blog as a result when folks want to know something about zombie processes, even though this site ... 7/14/2012 12:46:09 AM
|