[ic] PERL_SIGNALS=unsafe

Peter peter at pajamian.dhs.org
Wed Jul 22 04:39:24 UTC 2015


I'm in a situation where a bit of code in a usertag that I have which
uses an alarm does not work properly with PERL_SIGNALS=unsafe (it works
fine with PERL_SIGNALS=safe).  As a result I'm trying to understand what
the reasoning is for the PERL_SIGNALS=unsafe recommendation in Interchange?

Just FYI the code that I'm having issues with is the following:

    my $try = 0;
    {
        eval {
            # Use an alarm to trigger the timeout
            local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
            alarm 5;

       # Do something here that sometimes locks up and needs to timeout

            alarm 0;
        };
        if ($@) {
            if ($try++ < 10 && $@ =~ /alarm/) {
                redo;
            }
            ::logError($@);
            return;
        }
    }

In the above code block, with PERL_SIGNALS=unsafe, if the timeout
condition occurs the first time then the alarm is properly triggered and
the code loops around and tries again, but the second time the alarm
doesn't trigger and so the block locks up until it times out via some
other mechanism.

As I said above, it works fine with PERL_SIGNALS=safe.


Peter



More information about the interchange-users mailing list