Problem with signals & exceptions...

Eric Lee Green eric at estinc.com
Tue Jul 27 20:06:56 EDT 1999


Gordon McMillan wrote: 
> Eric Lee Green writes:
> > I'm having trouble catching my thrown exceptions under FreeBSD 3.2.
> > I am using the Python 1.5.2 that came with FreeBSD 3.2 (well, on
> > disk 1 of the <n>-disk set). The following program works properly
> > under Red Hat Linux version 6.0 running a self-compiled Python 1.5.2
> > (in place of the 1.5.1 which comes with Red Hat 6.0, which does not
> > properly handle signals during socket i/o calls). How it works: it
> > listens to port 6664. When it gets a connection, it then sets an
> > alarm handler and alarm and then tries to read from the socket. If
> > it does not get data within 10 seconds, it then times out, at which
> > point the alarm handler throws an exception and aborts the socket
> > read.
> 
> Why not avoid the pain of signals (which have enough gotchas to
> destroy portability) and use a select with a 10 sec timeout. If
> there's nothing in the readable list when it returns, bail out.

Actually, I already came to that conclusion. The folks who do this stuff,
though, still need to know that something's not right on FreeBSD. The signal is
caught, the exception is thrown... and gets thrown up all over the table in the
example program that I posted.

-E




More information about the Python-list mailing list