Subject: | $R->read freezes sporadically |
(perl 5.8.0, Linux kernel 2.4.27, glibc 2.3.2)
Every so often, calling the read method ($R->read, where $R is a Statistics::R object) causes the program to hang. It might be the 1st call in one run of the program and the 160th in another, but it happens sooner or later.
Specifying a timeout [$R->read(5)] doesn't help. (I'm assuming the $TIMEOUT is a time in seconds, the documentation doesn't actually say.)
When the program does freeze, there's always a file called "input.1.r" in /tmp/Statistics-R, and the last line of process.log contains some number other than 1. Renaming the input file to match the last line of process.log ends the freeze (though read sometimes returns '').
I've tried wrapping the read in an eval and setting an alarm to break out of a freeze:
my $rsays;
eval {
local $SIG{ALRM} = sub {die "hung\n"};
alarm 5;
$rsays = $R->read;
alarm 0;
};
{then checks on $@, etc}
This fails: invoking read apparently derails the alarm.
Any child processes (whatever they're doing) also freeze when the parent chokes on a read.