From: Howard Chu Date: Wed, 27 Aug 2008 22:28:16 +0000 (+0000) Subject: Avoid deadlocks on reader txns X-Git-Tag: ACLCHECK_0~1406 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e5b96f2c764f2ca8106560a9e46d3a9880cc2a12;p=openldap Avoid deadlocks on reader txns --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 9c7d4f8949..438ae9587d 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -1481,7 +1481,7 @@ bdb_reader_get( Operation *op, DB_ENV *env, DB_TXN **txn ) if ( ldap_pvt_thread_pool_getkey( ctx, env, &data, NULL ) ) { for ( i=0, rc=1; rc != 0 && i<4; i++ ) { - rc = TXN_BEGIN( env, NULL, txn, DB_READ_COMMITTED ); + rc = TXN_BEGIN( env, NULL, txn, DB_READ_COMMITTED | DB_TXN_NOWAIT ); if (rc) ldap_pvt_thread_yield(); } if ( rc != 0) { diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 69746e5127..14bd1b1bfc 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -61,7 +61,7 @@ bdb_db_init( BackendDB *be, ConfigReply *cr ) /* DBEnv parameters */ bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR ); - bdb->bi_dbenv_xflags = 0; + bdb->bi_dbenv_xflags = DB_TIME_NOTGRANTED; bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE; bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE; @@ -503,7 +503,7 @@ shm_retry: } if ( !quick ) { - TXN_BEGIN(bdb->bi_dbenv, NULL, &bdb->bi_cache.c_txn, DB_READ_COMMITTED); + TXN_BEGIN(bdb->bi_dbenv, NULL, &bdb->bi_cache.c_txn, DB_READ_COMMITTED | DB_TXN_NOWAIT); } entry_prealloc( bdb->bi_cache.c_maxsize );