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

Jeremy Allison jra at samba.org
Tue Jan 8 16:31:58 MST 2013


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.

Jeremy.


More information about the samba-technical mailing list