develooper Front page | perl.perl5.porters | Postings from May 2003

[perl #21382] exit()/exec() crashes Perl after fork

Thread Previous | Thread Next
Casey West
May 15, 2003 09:23
[perl #21382] exit()/exec() crashes Perl after fork
Message ID:
[replying and posting to p5p]

[Jens.Lippmann <!--c--> <i>at</i> <!--a--> - Wed Feb 26 13:26:38 2003]:
> Now, I actually spent quite a large amount of time to find a nasty bug
> that crashes Perl on Windows NT when I call fork and exec.
> The problem is not related to any specific Perl but rather sticks to
>    Perl
> ports that create threads instead of processes.
> As soon as the exec'd task terminates there is a considerable high
>    chance
> (obviously a race condition) to crash perl.
> When I replace exec() with system() and exit() the problem pertains,
>    but
> not if I use system() and POSIX::_exit().

Ok, I have no access to a Win32 machine so I can't go on testing
this, but I can believe you.

> I am sending this bug report to the mainstream Perl development
> instead of any specific Win32 support group such as ActiveState or
> Indigo just because the 'bug' I am referring herein seems to be
> related in a deficient Perl documentation on this topic.
> My pledge is to build up a FAQ topic (perldoc -q) for fork that helps
> out of this remedy, and to extend the fork/exec sections in the
> perlfuncs doc module, and to overhaul the notorious
>  'if ($pid = fork()) { ... } else { ... exec/exit; }'
> examples that are used throughout the perlipc doc.

None of this has been done yet.  Is it all that necessary?  Has anyone
else found the need to have this documented in some way, somewhere?

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About