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

RE: Openldap/bdb instability



> -----Original Message-----
> From: owner-openldap-software@OpenLDAP.org 
> [mailto:owner-openldap-software@OpenLDAP.org] On Behalf Of 
> Pierangelo Masarati
> Sent: Friday, February 07, 2003 7:13 AM
> To: Olle.Westman@astrazeneca.com
> Cc: openldap-software@OpenLDAP.org
> Subject: Re: Openldap/bdb instability
> 
> 
> 
> > Hi, I've configured openldap-2.1.12 with sleepycat's bdb 
> (db-4.1.25). 
> > The ldap server runs awhile but then gets filled with error 
> messages:
> >
> > Feb 6 11:11:13 7U:server01 last message repeated 140 times Feb 6 
> > 11:11:15 7U:server01 slapd[170848]: <= bdb_equality_candidates: 
> > index_param failed (18)
> >
> > after a while the error messages are very many, and it all 
> ends with a 
> > failure to allocate bytes with ch_malloc, and slapd dumps core.
> >
> > Anyone recognizes these errors? slapd stands up for about 15-20 
> > minutes with about 100 clients accessing it as a source for name 
> > lookups.
> 
> The code 18 means LDAP_INAPPROPRIATE_MATCHING; this means the 
> attribute you're filtering does not support equality matching 
> or something like that; it does not automatically imply a 
> bug, it looks more like an invalid syntax or matching rule problem.
> 
> Can you dig a bit further in what is causing the error?
> 
> P.
> 
> -- 
> Pierangelo Masarati
> mailto:pierangelo.masarati@sys-net.it
> 

I believe it is a problem with bdb_idl_fetch_key (idl.c).
	Line 274: ID buf[BDB_IDL_DB_SIZE*5];
Is creating a stack overflow (that is a lot of memory for the stack).

Below is a proposed fix.

--- openldap-2.1.12.org\servers\slapd\back-bdb\idl.c	2003-02-07
17:02:58 -0500
+++ openldap-2.1.12\servers\slapd\back-bdb\idl.c	2003-02-07
17:02:52 -0500
@@ -272,5 +272,5 @@
 	 * too limited.
 	 */
-	ID buf[BDB_IDL_DB_SIZE*5];
+	ID *buf = SLAP_MALLOC( sizeof(ID)*BDB_IDL_DB_SIZE*5 );
 
 	{
@@ -307,4 +307,5 @@
 			"cursor failed: %s (%d)\n", db_strerror(rc), rc,
0 );
 #endif
+		SLAP_FREE( buf );
 		return rc;
 	}
@@ -341,4 +342,5 @@
 #endif
 				cursor->c_close( cursor );
+				SLAP_FREE( buf );
 				return -1;
 			}
@@ -357,7 +359,9 @@
 			"close failed: %s (%d)\n", db_strerror(rc2),
rc2, 0 );
 #endif
+		SLAP_FREE( buf );
 		return rc2;
 	}
 	if( rc == DB_NOTFOUND ) {
+		SLAP_FREE( buf );
 		return rc;
 
@@ -372,4 +376,5 @@
 			db_strerror(rc), rc, 0 );
 #endif
+		SLAP_FREE( buf );
 		return rc;
 
@@ -385,4 +390,5 @@
 			(long) sizeof( ID ), (long) data.size, 0 );
 #endif
+		SLAP_FREE( buf );
 		return -1;
 
@@ -398,7 +404,9 @@
 			(long) ((1 + ids[0]) * sizeof( ID )), (long)
data.size, 0 );
 #endif
+		SLAP_FREE( buf );
 		return -1;
 	}
 
+	SLAP_FREE( buf );
 	return rc;
 }