Python signal handling

Dave Swegen dswegen at software.plasmon.com
Thu Apr 18 06:40:52 EDT 2002


On Wed, Apr 17, 2002 at 02:26:05PM +0000, Michael Hudson wrote:
> Dave Swegen <dswegen at software.plasmon.com> writes:
> 
> > I've recently been bitten by a nasty (undocumented) feature in Perl,
> > where installing a signal handler to catch SIGCHLD will eventually cause
> > a core dump. So before I venture into any daemon handling in python I
> > was wondering if Python too suffers from problems with signal handling?
> 
> Python suffers from problems with signal handling, but it sounds like
> they're not the same problems as those suffered by perl.
> 
> > I believe the reason for perl's problem is that it isn't re-entrant, and
> > thus two rapidly incoming signals will cause perl to fo *Pooof*.
> 
> In Python, signal handlers (usually) get run in between opcodes, so if
> an opcode takes a particularly long time to run, your signal handler
> may not run until some time after the OS delivers the signal to your
> process.

Which is how I believe perl is going to do it. Having an implementation
which is slow (and behaves somewhat unexpectededly) is far better than
one which is fast, but fatally broken (and BLEEP! undocumented!).

Thanks for the info.

Cheers
    Dave





More information about the Python-list mailing list