From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 5 19:27:05 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 D4244106566B for ; Wed, 5 Oct 2011 19:27:05 +0000 (UTC) (envelope-from realbushman@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 88DE38FC08 for ; Wed, 5 Oct 2011 19:27:05 +0000 (UTC) Received: by qadz30 with SMTP id z30so2017816qad.13 for ; Wed, 05 Oct 2011 12:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=z8rYiqdjq8nIX27KbjS1m1p4obLCUJZzVEIoEHqCLkU=; b=d6BvY2WG4iBvP9KPBPCH31DUP86493SPZgCNvht2o88yQKRwI0oTqqW9OpHY4EPW32 Lx1xDOJEn0LbV9Vh8XF0xpNQ0SeYm0SwwhvZqskIy/W90t7uZUGAMR3TyJAWd9usjYp1 7Y9pVmvmZAS8Ec/CKBT6MzOyOBHSViuUdFvAU= MIME-Version: 1.0 Received: by 10.229.242.84 with SMTP id lh20mr2256062qcb.211.1317841340955; Wed, 05 Oct 2011 12:02:20 -0700 (PDT) Sender: realbushman@gmail.com Received: by 10.229.8.66 with HTTP; Wed, 5 Oct 2011 12:02:17 -0700 (PDT) In-Reply-To: References: <86sjn84wco.fsf@ds4.des.no> <86obxw4s4w.fsf@ds4.des.no> <86fwj84p8i.fsf@ds4.des.no> Date: Wed, 5 Oct 2011 21:02:17 +0200 X-Google-Sender-Auth: Pa8XF0LjD6tY2Ni-nN-3o1uFRIA Message-ID: From: Michael Bushkov To: Artem Belevich Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= , hackers@freebsd.org, =?ISO-8859-1?Q?Trond_Endrest=F8l?= 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: Wed, 05 Oct 2011 19:27:06 -0000 There are probably 2 things here: 1. There's some error in nsswitch<->nscd communication protocol that causes nsswitch to write into the closed socket. This is not trivial to investigate and will require analyzing nscd and client process logs side by side (and possibly adding some more logging). 2. Consequences of the aforementioned problem can probably be corrected by using _setsockopt(..., SO_NOSIGPIPE) in __open_cached_connection() in nscachedcli.c (http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/net/nscachedcli.c?rev= =3D1.3). I have no access to FreeBSD desktop at the moment - Artem, it would be cool if you can try the second solution. Cheers, Michael 2011/10/5 Artem Belevich : > 2011/10/4 Dag-Erling Sm=F8rgrav : >> Any chance of getting a backtrace from an unpatched nscd? =A0Ideally wit= h >> the change described here: >> >> http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dbin/136073#reply1 >> >> To test, stop nscd, then run it from the command line like so: >> >> $ su - >> # cd /tmp >> # ulimit -c 0 >> # /usr/sbin/nscd -nst >> (do something in another terminal that causes it to crash) >> # echo backtrace | gdb -batch -x /dev/stdin /usr/sbin/nscd nscd.core >> >> and send me the output from both nscd and gdb once it crashes. > > In my case it's top that dies with SIGPIPE. nscd keeps running just > fine. So, there's no backtrace from nscd. > > top receives SIGPIPE after it tries to write to the socket with nscd > on the other end. Apparently nscd closes connection on its end. > Running ktrace on top I see that before the write to nscd socket, > there's a read that returned 0 bytes. > > Here's top's backtrace. Alas I don't have libc with debug symbols handy: > > Program received signal SIGPIPE, Broken pipe. > 0x0000000800abe8cc in write () from /lib/libc.so.7 > (gdb) where > #0 =A00x0000000800abe8cc in write () from /lib/libc.so.7 > #1 =A00x0000000800aa3f44 in ftell () from /lib/libc.so.7 > #2 =A00x0000000800aa415f in ftell () from /lib/libc.so.7 > #3 =A00x0000000800aa2031 in __h_errno () from /lib/libc.so.7 > #4 =A00x0000000800a98311 in nsdispatch () from /lib/libc.so.7 > #5 =A00x0000000800a84d95 in getpwent_r () from /lib/libc.so.7 > #6 =A00x0000000800a84911 in acl_get_brand_np () from /lib/libc.so.7 > #7 =A00x0000000000404f7b in machine_init (statics=3D0x7fffffffe770, > do_unames=3D1 '\001') at /usr/srcdir/src.git/usr.bin/top/machine.c:258 > #8 =A00x000000000040a9ab in main (argc=3D1, argv=3D0x7fffffffe8c8) at > /usr/srcdir/src.git/usr.bin/top/../../contrib/top/top.c:464 > > --Artem > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " > > >