[dancer-users] How can a fork+system() Dancer app not create zombie processes?

Shlomi Fish shlomif at shlomifish.org
Fri Apr 14 12:58:20 BST 2017


On Fri, 14 Apr 2017 11:58:46 +0100
Andrew Beverley <andy at andybev.com> wrote:

> On Thu, 13 Apr 2017 13:11:38 +0300 Shlomi Fish wrote:
> > sorry it took me so long to try that. I've now tried your suggestion
> > of double-forking and I'm still getting zombies. See:
> > 
> > *
> > https://bitbucket.org/shlomif/app-notifier/branch/zombies-processes-bug
> > 
> > How can it be fixed?  
> 
> You need to also copy the code for the exit:
> 
>     POSIX::_exit(0);
> 
> Reasons here: stackoverflow.com/questions/5422831/
> 

Thanks!

> Incidentally I noticed this:
> 
>     if (fork() eq 0)
> 
> eq is for comparing strings, and you could just write:
> 
>     if (!fork)
> 

But I want this check to fail if fork() returns undef().

Regards,

	Shlomi Fish

> Andy



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Rethinking CPAN - http://shlom.in/rethinking-cpan

<mst> I find it’s usually safe to assume that whatever shlomif’s doing, there
isn’t a good reason for it.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


More information about the dancer-users mailing list