[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Can't kill idle slapds on FreeBSD 4.0



Bryan Mawhinney wrote:
> > I'm not even sure what the POSIX signal semantics ARE, so please
> > forgive me if I'm being stupid here.  The siginterrupt man page
> > says "System call restart has been the default behaviour since
> > 4.2BSD, and is the default behaviour for signal(3) on FreeBSD."
> 
> After some poking around, I think I may have figured out what's
> happening.  The threaded libc_r which comes with FreeBSD includes
> an implementation of signal in which the default is NOT to restart
> interrupted system calls.  However, the libc_r Makefile does not
> include signal.o in HIDDEN_SYSCALLS, so the libc version (with
> conflicting semantics) is used instead.
> 
> Including a signal implementation which calls sigaction with
> sa_flags = 0 solved the problem.  Note that calling
> siginterrupt doesn't help, presumably because it is not thread
> aware.
> 
> Does this make sense?  And if so, is this a FreeBSD bug, or
> just an OpenLDAP porting issue?

A FreeBSD bug.  Good catch.

Strange that I don't see it, but my machines have always
been fortunate to have been born under lucky stars...

The system call restart semantics were changed in FreeBSD
to conform to POSIX a long time ago, so I think the man
page is broken, as well.

Normally, if you have historical behaviour, that's where
you see the calls being "magically" interrupted by using
longjmp() calls in alarm() handlers (a classic BSDism).

As I said before, it's a lot easier to write a threads
library if you know system calls will be restarted, since
you don't have to wrapper everything and you save ~2 extra
system calls per system call in libc_r.

You should definitely bugreport this.

-- Terry Lambert
-- Whistle Communications, Inc., an I.B.M. Company
-- terry@whistle.com
-------------------------------------------------------------------
This is formal notice under California Assembly Bill 1629, enacted
9/26/98 that any UCE sent to my email address will be billed $50
per incident to the legally allowed maximum of $25,000.