[Haskell-beginners] System.Process.createProcess does not terminate

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Sat Jun 26 20:59:01 EDT 2010

Hash: SHA1

On 6/26/10 18:57 , John Obbele wrote:
> After digging things a little, it seems I am messing with the
> System.Process.createProcess function : none of my spawned
> process terminates and eventually my OS freezes. (trivia: well
> now, I know that Fedora cannot handle more than 1100 processes on
> my cheap laptop ^^)
> I've attached a small haskell file which can easily reproduces my
> problem. If you, carefully, run it from the GHCi prompt while
> monitoring your pool of processes, you will probably see a
> hundred of zombie processes appearing.

You need to reap zombies manually; take a look at
System.Process.waitForProcess.  (On POSIX-ish systems, including Linux, you
can use the signal handling functions to auto-reap; on Linux simply setting
SIGCHLD to SIG_IGN is good enough, but other systems (*BSD, OSX) require you
to also set the SA_NOCLDWAIT flag and for portability you should include it.
 (Which, I note, doesn't seem to be supported in System.Posix.Signals.  O
Haskell gods:  Bug?)

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the Beginners mailing list