On Mon, Oct 19, 2009 at 2:17 PM, Bogart Salzberg <webmas...@inkfist.com> wrote:
> Mongers,
>
> I recently encountered a puzzling dilemma. You might find it interesting, or
> obvious (probably not both) and it leads to a question about how perl
> handles signals.
[...]

perldoc perlipc

Search for "Deferred Signals (Safe Signals)".

If safe signals are on (the default), then signals are not caught
until the current opcode finishes running.  Unfortunately this can be
forever.  For example you can encounter this if you're blocking on I/O
and no I/O happens.

There are a couple of options available.  The simplest being to set
the PERL_SIGNALS environment variable to "unsafe".  However that is
unsafe, and you can dump core.  I've generally gone with that approach
anyways, though, because I've wanted to do things like force a
database connection to Oracle to timeout.

Other options include trying to use the :perlio layer (with the
default configuration it is the default, but you may have a Perl
compiled without it) or to carefully use unbuffered I/O so that you're
never blocked in an uninterruptable op-code.

Cheers,
Ben

_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to