From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 8 12:31:10 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B2691065673; Sat, 8 Oct 2011 12:31:10 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id E04DA8FC08; Sat, 8 Oct 2011 12:31:09 +0000 (UTC) Received: from toad.stack.nl (toad.stack.nl [IPv6:2001:610:1108:5010::135]) by mx1.stack.nl (Postfix) with ESMTP id C37E31DD436; Sat, 8 Oct 2011 14:31:08 +0200 (CEST) Received: by toad.stack.nl (Postfix, from userid 1677) id BBF0F3F46B; Sat, 8 Oct 2011 14:31:08 +0200 (CEST) Date: Sat, 8 Oct 2011 14:31:08 +0200 From: Jilles Tjoelker To: Artem Belevich Message-ID: <20111008123108.GA44476@stack.nl> References: <86sjn84wco.fsf@ds4.des.no> <86obxw4s4w.fsf@ds4.des.no> <86fwj84p8i.fsf@ds4.des.no> <86wrcjf767.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Michael Bushkov , Dag-Erling Sm?rgrav , hackers@freebsd.org, Trond Endrest?l Subject: Re: Does anyone use nscd? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Oct 2011 12:31:10 -0000 On Wed, Oct 05, 2011 at 03:54:00PM -0700, Artem Belevich wrote: > 2011/10/5 Dag-Erling Sm?rgrav : > > Michael Bushkov 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