]> git.sur5r.net Git - openldap/commitdiff
For ITS#2502 - force release of locks on exiting threads
authorHoward Chu <hyc@openldap.org>
Fri, 9 May 2003 22:30:28 +0000 (22:30 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 9 May 2003 22:30:28 +0000 (22:30 +0000)
servers/slapd/back-bdb/cache.c

index f9d28852b7a583e9e22481765d967bdc744ed45e..832e4931c4774e4d89b2e5bda37d42ca928088c7 100644 (file)
@@ -926,8 +926,28 @@ bdb_locker_id_free( void *key, void *data )
 {
        DB_ENV *env = key;
        int lockid = (int) data;
+       int rc;
+
 
-       XLOCK_ID_FREE( env, lockid );
+       rc = XLOCK_ID_FREE( env, lockid );
+       if ( rc == EINVAL ) {
+               DB_LOCKREQ lr;
+#ifdef NEW_LOGGING
+               LDAP_LOG( BACK_BDB, ERR,
+                       "bdb_locker_id_free: %d err %s(%d)\n",
+                       lockid, db_strerror(rc), rc );
+#else
+               Debug( LDAP_DEBUG_ANY,
+                       "bdb_locker_id_free: %d err %s(%d)\n",
+                       lockid, db_strerror(rc), rc );
+#endif
+               memset( &lr, 0, sizeof(lr) );
+
+               /* release all locks held by this locker. */
+               lr.op = DB_LOCK_PUT_ALL;
+               env->lock_vec( env, lockid, 0, &lr, 1, NULL );
+               XLOCK_ID_FREE( env, lockid );
+       }
 }
 
 int