[Python-Dev] Python continually calling sigprocmask() on FreeBSD 5

Andrew MacIntyre andymac at bullseye.apana.org.au
Wed May 11 12:51:27 CEST 2005


Michael Hudson wrote:
> Suleiman Souhlal <ssouhlal at FreeBSD.org> writes:
>
>>While investigating why the script used in http://docs.freebsd.org/ 
>>cgi/getmsg.cgi?fetch=148191+0+current/freebsd-stable used so much  
>>system time on FreeBSD 5, I noticed that python is continually  
>>calling sigprocmask(), as can be seen from the following ktrace(1) dump:
>>
>>    673 python   0.000007 CALL  sigprocmask(0x3,0,0x811d11c)
>>    673 python   0.000005 RET   sigprocmask 0
>>    673 python   0.000009 CALL  sigprocmask(0x1,0,0x8113d1c)
>>    673 python   0.000005 RET   sigprocmask 0
>>etc..
>>
>>This is using Python 2.4.1.
>>Any clue about why this is happening?
> 
> 
> In a word, no.
> 
> As far as I am aware, there are no calls whatsoever to sigprocmask in
> Python 2.4.1 (there were in 2.3.X, but these were connected to threads
> and the mentioned script doesn't use them).  So you need to do some
> digging of your own.

As I noted in a followup to the FreeBSD list where this came up, this
appears to be a consequence of FreeBSD's Python port being configure'ed
with the "-with-fpectl" option.  This option uses setjmp()/longjump()
around floating point ops for FP exception management, and it is the
setjmp()/longjmp() in the FreeBSD threaded C libs that calls
sigprocmask() as above.

This option was certainly required for FreeBSD 4.x and earlier, where
SIGFPE wasn't masked by default (at least that's my understanding of
why the option was required...).  I have the understanding that starting
with 5.0 or 5.1, FreeBSD now does mask SIGFPE by default and so this
option may not be necessary in this environment.  A FreeBSD list member
with a 5.3 system tested the microbenchmark that exposed the issue with
a Python interpreter built without "-with-fpectl" and the performance
issue disappeared.  It is not yet clear whether it is appropriate that
the port be changed to drop this configure option.

Regards,
Andrew.

-------------------------------------------------------------------------
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-Dev mailing list