Hi all,
I'm getting the following error while forking the process using the fork n exec.
kernel: application bug: script1(17668) has SIGCHLD set to SIG_IGN but calls wait().
kernel: (see the NOTES section of 'man 2 wait'). Workaround activated.
Here is the code I'm using for forking process.
* Ignore child.
* Fork the process.
* Send STDOUT/STDERR to files.
-----------------------------------------------------------
my $fork_retry = 10;
my $timelimit = 86400;
my $signal = 0;
my $pid;
local $SIG{'CHLD'} = 'IGNORE';
FORK:
{
if ( $pid = fork )
{
return($pid);
}
else
{
die "cannot fork: $!" unless defined $pid;
open(STDOUT,"> $logfile.out");
open(STDERR,"> $logfile.err");
local $SIG{'INT'} = "IGNORE";
alarm $timelimit; # set the timeout
exec ("$cmd");
die "Unable to exec $cmd : @_\n";
}
warn "Unable to fork"."Retrying in $fork_retry seconds.\n";
sleep $fork_retry;
redo FORK;
}
-----------------------------------------------------------
Thanks.
20060131 Janitored by Corion: Moved code into code tags
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.