Freebsd thread/signal problem

Andrew MacIntyre andymac at bullseye.apana.org.au
Thu Feb 10 07:02:46 EST 2005


snacktime wrote:

>  This is on freebsd 5.3-release-p2 with python 2.4 and twisted both
> installed from ports.  I tested it on Debian (sarge) and the signals
> work fine.

I don't have a 5.x system usable at the moment, but last time I looked 
there were 3 possible threading options - the 4.x libc_r, libksr and 
libthr.  You should determine which it is and see whether one of the 
alternatives changes the behaviour in your favour.

> It's like there is some sort of event loop that isn't working
> correctly.  Freebsd is obviously getting the signal, but it doesn't
> act on it until another request comes in from the client.

There are semantic differences between Linux & *BSD kernels regarding 
interruptability of certain system calls (at least in the presence of 
threads).

If the twisted reactor is using read() instead of recv() this may 
explain what you are seeing.  You may find some bits in the comments and 
attachments of SF #944119 which could be used to test the signal 
behaviour.  In particular the C test case could be used to verify the 
behaviour of the differing threads implementations (on FreeBSD 4.8 with 
libc_r, the test case must be SIGKILLed whereas without threads it works).

There is old wisdom that signals and threads should not be mixed, as the
behaviour is not well defined across platforms.

-------------------------------------------------------------------------
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
         andymac at pcug.org.au             (alt) |        Belconnen ACT 2616
Web:    http://www.andymac.org/               |        Australia



More information about the Python-list mailing list