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

Re: Occasional corrupt DN in be_add logs under 2.4.16



Hi,

Thanks for the patch, however it looks like the problem is still there.

On Tue, May 5, 2009 at 1:01 PM, Howard Chu <hyc@symas.com> wrote:
Sean Burford wrote:
On Tue, May 5, 2009 at 12:52 PM, Howard Chu <hyc@symas.com
<mailto:hyc@symas.com>> wrote:

   Sean Burford wrote:

       slapcat shows no problems with the entry on the 2.4.16 host.

       Since the database looks fine I wonder if this is just a logging
       issue.
       Should this Debug statement in syncrepl.c actually use
       op->ora_e->e_name.bv_val or some other attribute?


   Looks like a side-effect of ITS#5326. And no, you can't use
   op->ora_e because the backend may free it before returning
   (back-bdb/hdb definitely do).


Do you agree that this looks like a logging issue rather than a database
issue?

Yes, and it is fixed now in HEAD.

I've got three 2.4.16 servers running with the patched add.c from head.  They are replicating from the 2.3.43 server.  One of them logged this today (the other two logged the correct DN) indicating that this is still an issue:

May  6 12:10:27 ldapserver slapd[29037]: syncrepl_message_to_op: rid=100 be_add µ-ESCxxxxxxxxxx,ou=people,dc=example,dc=com (0)

4 characters were lost (uid=) under the µ-ESC.  xxxxxxxxxx masks the uid.

For reference I've attached the patch I used.

--
Thanks,
Sean Burford
Possible patch for "Occasional corrupt DN in be_add logs under 2.4.16"
from OpenLDAP CVS.  Should already be provided in upstream 2.4.17+.

--- servers/slapd/back-bdb/add.c.orig	2009-03-05 10:40:00.000000000 -0800
+++ servers/slapd/back-bdb/add.c	2009-05-05 13:19:06.728827000 -0700
@@ -1,5 +1,5 @@
 /* add.c - ldap BerkeleyDB back-end add routine */
-/* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/add.c,v 1.152.2.17 2009/03/05 18:40:00 quanah Exp $ */
+/* $OpenLDAP: /servers/slapd/back-bdb/add.c,v 1.183 2009/05/05 19:54:01 hyc Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
  * Copyright 2000-2009 The OpenLDAP Foundation.
@@ -293,6 +293,27 @@ retry:	/* transaction retry */
 
 	/* free parent and reader lock */
 	if ( p != (Entry *)&slap_entry_root ) {
+		if ( p->e_nname.bv_len ) {
+			struct berval ppdn;
+
+			/* ITS#5326: use parent's DN if differs from provided one */
+			dnParent( &op->ora_e->e_name, &ppdn );
+			if ( !dn_match( &p->e_name, &ppdn ) ) {
+				struct berval rdn;
+				struct berval newdn;
+
+				dnRdn( &op->ora_e->e_name, &rdn );
+
+				build_new_dn( &newdn, &p->e_name, &rdn, NULL ); 
+				if ( op->ora_e->e_name.bv_val != op->o_req_dn.bv_val )
+					ber_memfree( op->ora_e->e_name.bv_val );
+				op->ora_e->e_name = newdn;
+
+				/* FIXME: should check whether
+				 * dnNormalize(newdn) == e->e_nname ... */
+			}
+		}
+
 		bdb_unlocked_cache_return_entry_r( bdb, p );
 	}
 	p = NULL;