From a2fb904458713b493e3b84bafa1771675d1bced9 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Sat, 7 Apr 2012 09:05:18 -0600 Subject: [PATCH 3/4] Ticket #336 - [abrt] 389-ds-base-1.2.10.4-2.fc16: index_range_read_ext: Process /usr/sbin/ns-slapd was killed by signal 11 (SIGSEGV) https://fedorahosted.org/389/ticket/336 Resolves: Ticket #336 Bug Description: [abrt] 389-ds-base-1.2.10.4-2.fc16: index_range_read_ext: Process /usr/sbin/ns-slapd was killed by signal 11 (SIGSEGV) Reviewed by: nhosoi (Thanks!) Branch: 389-ds-base-1.2.10 Fix Description: 1) Entries can be deleted out from under a search operation. The range read code was not handling this situation correctly. The code should notice that the index query was empty, and continue to the next highest key in the range. 2) DB cursor c_close() functions can return DB_LOCK_DEADLOCK that must be reported to the higher level operation functions. If not, then subsequent operations in the same transaction fail. When a DB_LOCK_DEADLOCK is returned by any DB update operation in the transaction, the transaction must be aborted and a new transaction begun before any other transacted db operations can occur. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: no BZ: 808770 (cherry picked from commit d09ce0e3ab2ea24496ee44622b050e007bb3cb8a) --- ldap/servers/slapd/back-ldbm/index.c | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c index 0ed6918..0ede6de 100644 --- a/ldap/servers/slapd/back-ldbm/index.c +++ b/ldap/servers/slapd/back-ldbm/index.c @@ -1496,14 +1496,23 @@ index_range_read_ext( if(retry_count == IDL_FETCH_RETRY_COUNT) { ldbm_nasty("index_range_read retry count exceeded",1095,*err); } - tmp2 = idl_union( be, idl, tmp ); - idl_free( idl ); - idl_free( tmp ); - idl = tmp2; - if (ALLIDS(idl)) { - LDAPDebug(LDAP_DEBUG_TRACE, "index_range_read hit an allids value\n", - 0, 0, 0); - break; + if (!idl) { + if (slapi_is_loglevel_set(LDAP_DEBUG_TRACE)) { + char encbuf[BUFSIZ]; + LDAPDebug2Args(LDAP_DEBUG_TRACE, + "index_range_read_ext: cur_key=%s(%li bytes) was deleted - skipping\n", + encoded(&cur_key, encbuf), (long)cur_key.dsize); + } + } else { + tmp2 = idl_union( be, idl, tmp ); + idl_free( idl ); + idl_free( tmp ); + idl = tmp2; + if (ALLIDS(idl)) { + LDAPDebug(LDAP_DEBUG_TRACE, "index_range_read hit an allids value\n", + 0, 0, 0); + break; + } } if (DBT_EQ (&cur_key, &upperkey)) { /* this is the last key */ break; -- 1.7.1