[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 20000124.004] "perl in malloc(): warning: recursive call" on



Lars Eggert writes:
> Running the following test script causes perl to crash. You may need
> to run the script several times before seeing the problem. (The script
> spawns a child process that does nothing but write to an array. The
> parent signals the child periodically.)

Signals and Perl do not mix.  Please do not use signals if a segfault
is not a desirable form of output.

>   $SIG{ALRM} = sub { $state++ };

One should not do anything as bad as that in a sighandler.  What is
the failure rate you see?  You may get slightly better rate (3% in my
tests) with something like

$SIG{ALRM} = sub { ++$state ; return };

and preallocating 

  $state = 0;

Ilya


Follow-Ups from:
Lars Eggert <larse@ISI.EDU>
References to:
Lars Eggert <larse@ISI.EDU>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]