From andrew@ugh.net.au  Fri Jun 26 17:20:31 2009
Return-Path: <andrew@ugh.net.au>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A03EC106568A;
	Fri, 26 Jun 2009 17:20:31 +0000 (UTC)
	(envelope-from andrew@ugh.net.au)
Received: from mtagate5.uk.ibm.com (mtagate5.uk.ibm.com [195.212.29.138])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A1AF8FC16;
	Fri, 26 Jun 2009 17:20:30 +0000 (UTC)
	(envelope-from andrew@ugh.net.au)
Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193])
	by mtagate5.uk.ibm.com (8.14.3/8.13.8) with ESMTP id n5QH2A4i189282;
	Fri, 26 Jun 2009 17:02:10 GMT
Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228])
	by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n5QH1vtl1495074;
	Fri, 26 Jun 2009 18:02:10 +0100
Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1])
	by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n5QH1vt3003864;
	Fri, 26 Jun 2009 18:01:57 +0100
Received: from anu.hursley.ibm.com (emmi.hursley.ibm.com [9.20.217.22])
	by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n5QH1vGM003861
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 26 Jun 2009 18:01:57 +0100
Received: from anu.hursley.ibm.com (localhost [127.0.0.1])
	by anu.hursley.ibm.com (8.14.3/8.14.3) with ESMTP id n5QGannu003914;
	Fri, 26 Jun 2009 17:36:51 +0100 (BST)
	(envelope-from astevens@localhost.hursley.ibm.com)
Received: (from astevens@localhost)
	by anu.hursley.ibm.com (8.14.3/8.14.3/Submit) id n5QGahJn003911;
	Fri, 26 Jun 2009 17:36:43 +0100 (BST)
	(envelope-from astevens)
Message-Id: <200906261636.n5QGahJn003911@anu.hursley.ibm.com>
Date: Fri, 26 Jun 2009 17:36:43 +0100 (BST)
From: Andrew Stevenson <andrew@ugh.net.au>
Reply-To: Andrew Stevenson <andrew@ugh.net.au>
To: FreeBSD-gnats-submit@freebsd.org
Cc: des@freebsd.org
Subject: recent nscd changes cause client processes to die with SIGPIPE
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         136073
>Category:       bin
>Synopsis:       recent nscd(8) changes cause client processes to die with SIGPIPE
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    des
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 26 17:30:01 UTC 2009
>Closed-Date:    
>Last-Modified:  Sun Apr  6 12:00:00 UTC 2014
>Originator:     Andrew Stevenson
>Release:        FreeBSD 7.2-STABLE i386
>Organization:
UgH!
>Environment:
System: FreeBSD anu.hursley.ibm.com 7.2-STABLE FreeBSD 7.2-STABLE #14: Thu Jun 25 12:28:57 BST 2009 root@anu.hursley.ibm.com:/usr/obj/usr/src/sys/ANU i386


	
>Description:

After upgrading to stable as of 2 days ago I have found that processes
trying to fetch password data frequently die with SIGPIPE. My
nsswitch.conf contains:

passwd: files cache ldap
group: files cache ldap

Removing cache makes the problem go away, as does reverting to nscd from
7.2-RELEASE. If I run nscd -nst (nscd from stable) it logs the error:

E3 from on_mp_write_session_write_response_write1: write failed

when the problem occurs. I had a quick look at the code but didn't
understand the structure well enough to know what it was supposed to be
doing. I have 2 ldap servers configured both using ldaps.

This prevented me from logging into the machine after the upgrade though
I had console access so could recover.

>How-To-Repeat:

Any password checking process seems to suffer - e.g. try to log on from
the console or via XDM or su from an existing shell. Oddly ssh, even
when using passwords seems unaffected. I used "logins" to do most of my
testing.

>Fix:

Work around is to revert to nscd from 7.2-RELEASE or to change
nsswitch.conf to not use cache.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Sun Jun 28 18:01:01 UTC 2009 
Responsible-Changed-Why:  
My bug 

http://www.freebsd.org/cgi/query-pr.cgi?pr=136073 

From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/136073: recent nscd changes cause client processes to die with SIGPIPE
Date: Sun, 28 Jun 2009 20:03:26 +0200

 Andrew Stevenson <andrew@ugh.net.au> writes:
 > Removing cache makes the problem go away, as does reverting to nscd from
 > 7.2-RELEASE. If I run nscd -nst (nscd from stable) it logs the error:
 >
 > E3 from on_mp_write_session_write_response_write1: write failed
 >
 > when the problem occurs.
 
 Can you change "#if 0" to #if 1" in debug.h, and see if you get any
 traces from query_socket_write() or query_io_buffer_write()?
 
 DES
 --=20
 Dag-Erling Sm=C3=B8rgrav - des@des.no

From: geoffroy desvernay <dgeo@centrale-marseille.fr>
To: bug-followup@FreeBSD.org, andrew@ugh.net.au
Cc:  
Subject: Re: bin/136073: recent nscd(8) changes cause client processes to
 die with SIGPIPE
Date: Wed, 03 Mar 2010 14:29:14 +0100

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig5AAF64701C14B05034233B23
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 I have the same problem I think (or something very similar), on two
 machines running
 - 7.2-STABLE Mon Oct 19 23:16:15 CEST 2009
 - 7.3-PRERELEASE Wed Mar  3 00:00:20 CET 2010
 (GENERIC + SMP + QUOTA + carp kernels)
 
 The two machines use net/nss_ldap for system accounts, and
 nsswitch.conf's 'passwd' and 'group': cache files ldap
 (tested also with 'files cache ldap')
 
 nscd.conf is (reverted to) standard one.
 
 it doesn't happen on every situations:
 - local mails are delivered normally (That's why I didn't noticed this
 before) by dovecot's "deliver"
 - crons are not executed (even if they appear in cron's log as executed).=
 =2E.
 
 Easier for testing: "getent passwd" is ok but "id login" not...
 
 running # nscd -nst
 shows the same error:
 E3 from on_mp_write_session_write_response_write1: write failed
 
 I tried with debug as suggested:
 =3D> process_socket_event
         =3D> on_mp_write_session_write_response_write1
                 =3D> get_cache_mp_write_session_write_response
                 <=3D get_cache_mp_write_session_write_response
                 =3D> query_io_buffer_write
                 <=3D query_io_buffer_write
 E3 from on_mp_write_session_write_response_write1: write failed
         <=3D on_mp_write_session_write_response_write1
         =3D> destroy_query_state
                 =3D> on_mp_write_session_destroy
                         =3D> finalize_comm_element
                                 =3D>
 finalize_cache_mp_write_session_write_request
                                 <=3D
 finalize_cache_mp_write_session_write_request
                         <=3D finalize_comm_element
                         =3D> finalize_comm_element
                                 =3D>
 finalize_cache_mp_write_session_write_response
                                 <=3D
 finalize_cache_mp_write_session_write_response
                         <=3D finalize_comm_element
                         =3D> configuration_lock_entry
                         <=3D configuration_lock_entry
                         =3D> abandon_cache_mp_write_session
                                 =3D> destroy_cache_mp_write_session
                                 <=3D destroy_cache_mp_write_session
                         <=3D abandon_cache_mp_write_session
                         =3D> configuration_unlock_entry
                         <=3D configuration_unlock_entry
                 <=3D on_mp_write_session_destroy
         <=3D destroy_query_state
 <=3D process_socket_event
 
 full log is available on http://dgeo.perso.ec-m.fr/LOG.nscd
 
 I've no skills on c programming, but I may test any patch or ?
 
 It would be wonderful if this bug could be resolved before 7.3 is release=
 d !
 
 HTH
 --=20
 *geoffroy desvernay*
 C.R.I - Administration syst=E8mes et r=E9seaux
 Ecole Centrale de Marseille
 
 
 --------------enig5AAF64701C14B05034233B23
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (FreeBSD)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAkuOZDAACgkQGbFYzwF8gKoycACeIVzB4H8PsbFeMOh48nwytclh
 desAnRtevbJKOAoWMl90O5sF9TyQ5Ruo
 =Iyzp
 -----END PGP SIGNATURE-----
 
 --------------enig5AAF64701C14B05034233B23--

From: geoffroy desvernay <dgeo@centrale-marseille.fr>
To: bug-followup@FreeBSD.org, andrew@ugh.net.au, 
 freebsd-stable@FreeBSD.org
Cc:  
Subject: Re: bin/136073: recent nscd(8) changes cause client processes to
 die with SIGPIPE
Date: Fri, 29 Apr 2011 11:40:05 +0200

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig3CBB833B104BECA81E87E6AE
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 This change is not so recent now... But I'm still experiencing this bug
 with 8.2p1 :(
 
 This bug happens with nss_ldap-1.265_6 and nss-pam-ldapd, using one or
 more ldap:// and|or ldaps:// servers, and cache enabled in nsswitch.conf.=
 
 
 Some symptoms:
 # id dgeo; echo $?
 141
 
 cron jobs are logged as executed but are not !
 
 I may test any patch or ?
 --=20
 *geoffroy desvernay*
 C.R.I - Administration syst=E8mes et r=E9seaux
 Ecole Centrale de Marseille
 
 
 --------------enig3CBB833B104BECA81E87E6AE
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.17 (FreeBSD)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iQEcBAEBAgAGBQJNuod1AAoJEC0NWrh8JT1SBE4H/1JmXDLdI/HGI8GxLsssd3vh
 i4mnz0+iNnzAWVH1lFJtwQeJmZx0Q33U1axP7S3ONqdojAMV0k7sakVYPquBy/10
 ikQDNG4XWLNfZxSQXVc9Y9t/TXCLxs96zR7ERa9DrAfx0MlqmctX4wv8Xu1QBM/c
 77Gb75Ml/xUpedbcpeMOonOHTpfOeAQrj5vwPi0EIZjwoZMym1GDHHsVabmCiDtp
 rvY2xZr6+BBYep76cQ9io+K8FfheQMBLhrPED8R8cbteEgYfs4l1Tk4sbVPthWhG
 iC/5IAJHRdfg6bMUOo1Ggzex9hHvmMXlIINWk11DvNe892nSMP4nLEqcPNT4uDA=
 =c9iM
 -----END PGP SIGNATURE-----
 
 --------------enig3CBB833B104BECA81E87E6AE--

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org, andrew@ugh.net.au
Cc:  
Subject: Re: bin/136073: recent nscd(8) changes cause client processes to die
 with SIGPIPE
Date: Sun, 6 Apr 2014 13:50:48 +0200

 In FreeBSD PR bin/136073, you wrote:
 > After upgrading to stable as of 2 days ago I have found that processes
 > trying to fetch password data frequently die with SIGPIPE. My
 > nsswitch.conf contains:
 
 > passwd: files cache ldap
 > group: files cache ldap
 
 > Removing cache makes the problem go away, as does reverting to nscd
 > from 7.2-RELEASE. If I run nscd -nst (nscd from stable) it logs the
 > error:
 
 > E3 from on_mp_write_session_write_response_write1: write failed
 
 > when the problem occurs. I had a quick look at the code but didn't
 > understand the structure well enough to know what it was supposed to
 > be doing. I have 2 ldap servers configured both using ldaps.
 
 > This prevented me from logging into the machine after the upgrade
 > though I had console access so could recover.
 
 Note that as of SVN r248252 (head and stable/10) and SVN r248651
 (stable/9), the nscd client code disables SIGPIPE. As a result, programs
 will try to do the lookup themselves if nscd has a problem.
 
 -- 
 Jilles Tjoelker
>Unformatted:
