Re: defunct performer process

New Message Reply Date view Thread view Subject view Author view

Richard McDonald (richard++at++gossamar.paradigmsim.com)
Thu, 2 Oct 1997 11:58:02 -0500


On Sep 30, 11:55am, Tom Impelluso wrote:

What you are expreriencing is the "zombie" process phenomenon. I just
recently had the same problem. Heres what you do:

Add a signal handler to your program as follows.

#include <sys/types.h>
#include <sys/wait.h>
#include <sys/prctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>

void done (int) { return; }

void main ( int argc, char **argv ) {

  // (bunch of initialization code)

  // setup signal handling using POSIX functions. This is required to
  // keep zombies from being created when one of the sproc children exits.

  struct sigaction act;
  sigemptyset ( &act.sa_mask );
  act.sa_handler = done;
  act.sa_flags = SA_NOCLDWAIT;
  if ( sigaction ( SIGCLD, &act, (struct sigaction *)NULL )) {
    perror ( "Can't setup signals with sigaction" );
    exit ( -1 );
  }

  // (still more code).

  int np = sproc ( mySprocfunction, some_sproc_related_flags );
  pid_t zz = waitpid ( np, 0, 0 );

  // The rest of your program.
}

Hope this helps.

> Subject: defunct performer process
>
> Hi,
>
> I have an xforms code that sprocs() a Performer code.
>
> performer_pid = sproc( /* etc */);
>
> Later, a button on the xforms code will send a signal to performer:
>
>
> kill(performer_pid,SIG_USR1);
>
>
> Inside the Performer code, just before the main loop, and just
> before the pfConfig(), I call signal:
>
> signal(SIG_USR1, graceful)
>
>
> Here is Graceful:
>
> void graceful() {
> pfuExitInput();
> pfuExitUtil();
> pfuExit();
> }
>
>
>
> Now, when I do a ps (while the xforms window API is still running),
> I no longer see a listing for the sproc'ed children. One would think
> I could use the same button that sproc'ed the peformer code and
> run it again. The window comes up, but nothing appears.
>
> As a further pathology, if I look at rsults from ps,
> I see that old Performer process still there, but listed as defunct.
> I cannot seem to have xform (or any other code, for that matter) send
> a signal to a perofrmer code taht will kill it once and for all,
> (without the defunts lying around).
>
> Help!
>
> Tom
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-- End of excerpt from Tom Impelluso

-- 
--

Richard McDonald ___________________________________________________________

richard++at++paradigmsim.com Paradigm Simulation, Inc. voice: (972) 960-2301 14900 Landmark Blvd Ste 400 fax: (972) 960-2303 Dallas, TX 75240-6725 ___________________________________________________________ ======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:03 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.