[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5565) slapd crashes due to SIGPIPE



--Boundary-00=_k1GdIEk7s64l4zW
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Saturday 21 June 2008 00:26:00 jwm@horde.net wrote:
> On Fri, Jun 20, 2008 at 01:37:15PM -0700, Howard Chu wrote:
> > > Program received signal SIGABRT, Aborted.
> > > [Switching to Thread -1963996240 (LWP 22635)]
> > > 0xb7bb1947 in raise () from /lib/tls/libc.so.6
> >
> > This trace resembles ITS#5401, which was only fixed in RE24. You can look
> > at the patch to syncprov.c there. There's no plan to make another 2.3
> > release at the moment.
>
> I don't mind patching for this locally, since slapd is crashing every few
> days. I looked at the patch for ITS 5401 in RE24. I don't know enough about
> slapd internals to easily backport it to RE23 since a fair bit of the
> surrounding code differs between RE23 and RE24; would you be willing to do

The patches I found for this in RE24 seem to apply without problems on RE23. 
See attached patch its5401-re23.patch.

Howard, this includes syncprov.c 1.219->1.220 and 1.147.2.27->1.147.2.28 (see 
attached its5401.patch), was that all?

Regards,
Buchan


--Boundary-00=_k1GdIEk7s64l4zW
Content-Type: text/x-diff;
  charset="utf-8";
  name="its5401-re23.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="its5401-re23.patch"

Index: servers/slapd/overlays/syncprov.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/overlays/syncprov.c,v
retrieving revision 1.56.2.50
diff -u -r1.56.2.50 syncprov.c
--- servers/slapd/overlays/syncprov.c	14 May 2008 00:49:04 -0000	1.56.2.50
+++ servers/slapd/overlays/syncprov.c	9 Jul 2008 07:22:23 -0000
@@ -1840,12 +1840,10 @@
 	op2->o_do_not_cache = 1;
 
 	/* Add op2 to conn so abandon will find us */
-	ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
 	op->o_conn->c_n_ops_executing++;
 	op->o_conn->c_n_ops_completed--;
 	LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op2, o_next );
 	so->s_flags |= PS_IS_DETACHED;
-	ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
 
 	/* Prevent anyone else from trying to send a result for this op */
 	op->o_abandon = 1;
@@ -1933,15 +1931,27 @@
 
 			/* Detach this Op from frontend control */
 			ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
+			ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
 
-			/* Turn off the refreshing flag */
-			ss->ss_so->s_flags ^= PS_IS_REFRESHING;
+			/* But not if this connection was closed along the way */
+			if ( op->o_abandon ) {
+				ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+				ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
+				/* syncprov_ab_cleanup will free this syncop */
+				return SLAPD_ABANDON;
 
-			syncprov_detach_op( op, ss->ss_so, on );
+			} else {
+				/* Turn off the refreshing flag */
+				ss->ss_so->s_flags ^= PS_IS_REFRESHING;
+
+				syncprov_detach_op( op, ss->ss_so, on );
 
-			/* If there are queued responses, fire them off */
-			if ( ss->ss_so->s_res )
-				syncprov_qstart( ss->ss_so );
+				ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+				/* If there are queued responses, fire them off */
+				if ( ss->ss_so->s_res )
+					syncprov_qstart( ss->ss_so );
+			}
 			ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
 
 			return LDAP_SUCCESS;

--Boundary-00=_k1GdIEk7s64l4zW
Content-Type: text/x-diff;
  charset="utf-8";
  name="its5401.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="its5401.patch"

--- servers/slapd/overlays/syncprov.c	2008/03/12 21:31:28	1.219
+++ servers/slapd/overlays/syncprov.c	2008/03/13 09:49:32	1.220
@@ -1,4 +1,4 @@
-/* $OpenLDAP: servers/slapd/overlays/syncprov.c,v 1.219 2008/03/12 21:31:28 ando Exp $ */
+/* $OpenLDAP: servers/slapd/overlays/syncprov.c,v 1.220 2008/03/13 09:49:32 hyc Exp $ */
 /* syncprov.c - syncrepl provider */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
@@ -1940,12 +1940,10 @@
 	op2->o_do_not_cache = 1;
 
 	/* Add op2 to conn so abandon will find us */
-	ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
 	op->o_conn->c_n_ops_executing++;
 	op->o_conn->c_n_ops_completed--;
 	LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op2, o_next );
 	so->s_flags |= PS_IS_DETACHED;
-	ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
 
 	/* Prevent anyone else from trying to send a result for this op */
 	op->o_abandon = 1;
@@ -2055,15 +2053,27 @@
 
 			/* Detach this Op from frontend control */
 			ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
+			ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
 
-			/* Turn off the refreshing flag */
-			ss->ss_so->s_flags ^= PS_IS_REFRESHING;
+			/* But not if this connection was closed along the way */
+			if ( op->o_abandon ) {
+				ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+				ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
+				syncprov_free_syncop( ss->ss_so );
+				return SLAPD_ABANDON;
 
-			syncprov_detach_op( op, ss->ss_so, on );
+			} else {
+				/* Turn off the refreshing flag */
+				ss->ss_so->s_flags ^= PS_IS_REFRESHING;
+
+				syncprov_detach_op( op, ss->ss_so, on );
 
-			/* If there are queued responses, fire them off */
-			if ( ss->ss_so->s_res )
-				syncprov_qstart( ss->ss_so );
+				ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+				/* If there are queued responses, fire them off */
+				if ( ss->ss_so->s_res )
+					syncprov_qstart( ss->ss_so );
+			}
 			ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
 
 			return LDAP_SUCCESS;
diff -u -r1.147.2.27 -r1.147.2.28
--- servers/slapd/overlays/syncprov.c	2008/05/28 16:35:32	1.147.2.27
+++ servers/slapd/overlays/syncprov.c	2008/05/29 15:02:45	1.147.2.28
@@ -1,4 +1,4 @@
-/* $OpenLDAP: servers/slapd/overlays/syncprov.c,v 1.147.2.27 2008/05/28 16:35:32 quanah Exp $ */
+/* $OpenLDAP: servers/slapd/overlays/syncprov.c,v 1.147.2.28 2008/05/29 15:02:45 hyc Exp $ */
 /* syncprov.c - syncrepl provider */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
@@ -2107,7 +2107,7 @@
 			if ( op->o_abandon ) {
 				ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
 				ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
-				syncprov_free_syncop( ss->ss_so );
+				/* syncprov_ab_cleanup will free this syncop */
 				return SLAPD_ABANDON;
 
 			} else {

--Boundary-00=_k1GdIEk7s64l4zW--