From jtk at cmp.uea.ac.uk  Fri Dec 15 16:11:42 2006
From: jtk at cmp.uea.ac.uk (Jan T. Kim)
Date: Fri, 15 Dec 2006 15:11:42 +0000
Subject: [Rd] fork package problem
In-Reply-To: <4582A35D.2000703@metrumrg.com>
References: <4582A35D.2000703@metrumrg.com>
Message-ID: <20061215151142.GC26567@jtkpc.cmp.uea.ac.uk>

On Fri, Dec 15, 2006 at 08:30:05AM -0500, billk01 wrote:
> I have been using the fork package on a cluster to spawn jobs.  I have 
> noticed that I end up with many "R defunct" (zombie) processes following 
> the use of fork that do not die completely until I close down R.  
> Initially, I thought it may be my code but I ran the example from the 
> latest fork package (see code below) on R.2.3.1 and ended up with the 
> same problem.  The code from the fork package that results in the R 
> defunct processes is as follows:
> 
> {
> pid = fork(slave=NULL)
> if(pid==0) {
> cat("Hi from the child process\n"); exit()
> } else {
> cat("Hi from the parent process\n");
> }
> 
> I am running R-2.3.1 Suse10 linux but the same error also occurs with 
> R.2.2.0.

This is what happens if you don't call wait (as the documentation
of fork demonstrates in an example, if I recall correctly).

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: jtk at cmp.uea.ac.uk                               |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*



[Rd] fork package problem
Jan T. Kim