Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Oct 2011 14:31:08 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Artem Belevich <art@freebsd.org>
Cc:        Michael Bushkov <bushman@freebsd.org>, Dag-Erling Sm?rgrav <des@des.no>, hackers@freebsd.org, Trond Endrest?l <Trond.Endrestol@fagskolen.gjovik.no>
Subject:   Re: Does anyone use nscd?
Message-ID:  <20111008123108.GA44476@stack.nl>
In-Reply-To: <CAFqOu6iTP_cHMoxU4T3buwrx_twEe3_g5rZ-bse8_uNYePv=Sg@mail.gmail.com>
References:  <86sjn84wco.fsf@ds4.des.no> <alpine.BSF.2.00.1110041800290.18373@mail.fig.ol.no> <86obxw4s4w.fsf@ds4.des.no> <CAFqOu6iw12BbvmS9NH3fNzWqQR1YvYrqyM6JFrYDfs2=HQ3w_w@mail.gmail.com> <86fwj84p8i.fsf@ds4.des.no> <CAFqOu6gf9LW2cRHAerTy5d29WN6y8mcWgUHwbKeAEBPXNwVz-w@mail.gmail.com> <CANkaO_F%2BeenvB-GSSJ-iZf8Lzu3TV0pLEokw_OjM-wNRXvHR3Q@mail.gmail.com> <86wrcjf767.fsf@ds4.des.no> <CAFqOu6iTP_cHMoxU4T3buwrx_twEe3_g5rZ-bse8_uNYePv=Sg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 05, 2011 at 03:54:00PM -0700, Artem Belevich wrote:
> 2011/10/5 Dag-Erling Sm?rgrav <des@des.no>:
> > Michael Bushkov <bushman@freebsd.org> writes:
> >> 2. Consequences of the aforementioned problem can probably be
> >> corrected by using _setsockopt(..., SO_NOSIGPIPE) in
> >> __open_cached_connection() in nscachedcli.c

> > That sounds like a workaround rather than a fix...

> Not necessarily. Using SO_NOSIGPIPE is a valid option when someone
> wants to see read/write on a closed socket fail and return -1 with
> errno=EPIPE.

> Quick grep in libc shows that resolver code in
> lib/libc/resolv/res_send.c also sets SO_NOSIGPIPE for exactly that
> reason.

Disabling SIGPIPE is good anyway because a crashing/dying nscd should
not cause applications to terminate. However, if EPIPE/SIGPIPE happens
in normal operation, that is still a bug that should be fixed.

By the way, SO_NOSIGPIPE is not in POSIX.1-2008 while the MSG_NOSIGNAL
flag to send() is. It may be better to replace the write() call with
send() with the MSG_NOSIGNAL flag and drop the setsockopt().

-- 
Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111008123108.GA44476>