I've inherited a program that had been running fine for years, but now is throwing errors all the time, and I have no idea why. As far as I can tell, the only change that was made was adding some debugging code in the general vicinity of the problem. I'm not knowledgeable about any IPC-related stuff, and have been reading what I can, but I don't understand what this is doing, which makes it hard to debug :-(
The program is a web form that shells out to an external (Perl) script to perform a time-consuming task. The structure of the relevant section is more or less this (none of this code is mine):
$SIG{CHLD} = 'IGNORE'; # ignore dead children, to avoid zombie process
+es
my $child = fork();
if ($child) { # parent; return data
$self->return_data( { data => $data } );
} else { # child; run external process
my $child_output;
eval { # gather a whole lot of data; assemble $external_command
use IPC::System::Simple 'capture';
$child_output = capture($external_command);
};
$self->log("Error when running [$external_command]: $child_output")
+if $child_output;
$self->log("Error when running [$external_command]: $@") if $@;
CORE::exit(0);
}
This is now constantly throwing errors having the form:
Error when running [{external command}]: "{external command}" failed t
+o start: "No child processes" at /path/to/web/program.pm line 459.
If anyone could suggest what's going on and how I can fix it, I would be very grateful indeed.