With FreeBSD 8.0 it seems like you can't block pending but undelivered signals

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Jan 8 23:57:26 MST 2013


On Tue, Jan 08, 2013 at 03:31:58PM -0800, Jeremy Allison wrote:
> On Tue, Jan 08, 2013 at 03:21:06PM -0800, Richard Sharpe wrote:
> > On Tue, Jan 8, 2013 at 2:50 PM, Jeremy Allison <jra at samba.org> wrote:
> > > On Tue, Jan 08, 2013 at 11:15:39AM -0800, Richard Sharpe wrote:
> > >>
> > >> OK, it seems that it is not so bad. Based on a response I got from the
> > >> FreeBSD Hackers mailing list, and some digging, I think the answer is:
> > >>
> > >>             sigaddset(&((ucontext_t *)uctx)->uc_sigmask, sig);
> > >>
> > >> I will try this soon and get back to you.
> > >>
> > >> >From here: http://stackoverflow.com/questions/5531006/returning-from-a-signal-handler-and-leaving-signal-masked
> > >
> > > Ok, the correct fix here (and one that will work on Linux too)
> > > is to ensure we never issue more aio requests than we have
> > > real-time-signal buckets to receive the responses for them.
> > >
> > > i.e. the "100" value inside smbd/aio.c is the real problem
> > > here, not blocking the rt-signal inside the handler.
> > >
> > > Match those sizes and you should not see this error
> > > occuring.
> > 
> > Well, that is very true. That was my first approach but I thought
> > someone was wedded to the notion of using a larger number in the aio
> > code than the tevent code.
> 
> 
> No, it's just an accident of history. Changed in one place and
> not another.
> 
> > We probably should allow the aio code to fetch the number of buckets
> > so it never issues more requests than there are bucked available.
> 
> Indeed - on Linux I think it is impossible for the signal
> handler function to change the main process mask, it's always
> restored on return.
> 
> This means it's an unfixable race condition on Linux (so much
> for my "what a FreeBSD bug" hypocracy :-), so we really must
> match these two sizes.

Just a side-note: The code in master and 4.0 is different,
we do not use the posix API code by default anymore, it is
only available as a module that you have to explicitly
select.

Richard, I know you are using 3.6.6, but you might want to
make a performance comparison using master between the
default aio_pthread and aio_posix approaches. The posix
aio API is phased out in Samba, it might be worthwhile to
backport the aio_pthread changes to 3.6.6. There we don't
use signals anymore.

With best regards,

Volker Lendecke

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list