Description of problem: I think the problem is in id2entry_delete: if (entryrdn_get_switch()) { ldbm_instance *inst = (ldbm_instance *)be->be_instance_info; Slapi_DN *sdn = slapi_sdn_dup(slapi_entry_get_sdn_const(e->ep_entry)); struct backdn *bdn = backdn_init(sdn, e->ep_id, 1); CACHE_REMOVE(&inst->inst_dncache, bdn); CACHE_RETURN(&inst->inst_dncache, &bdn); } backdn_init creates the backdn, but sets the refcnt to 0. then CACHE_RETURN calls dncache_return(). This triggers the assertion because refcnt is 0. ASSERT((*bdn)->ep_refcnt > 0); if (! --(*bdn)->ep_refcnt) { if ((*bdn)->ep_state & ENTRY_STATE_DELETED) { backdn_free(bdn); } else { lru_add(cache, (void *)*bdn); /* the cache might be overfull... */ if (CACHE_FULL(cache)) { dnflush = dncache_flush(cache); } } }
The previous problem was reported by rmeggins. (Thank you!!) When deleting an entry, if the dn is in the dn cache, it should be removed. The above code is trying to remove it regardless of the existence in the dn cache.
Created attachment 395555 [details] git patch file File: ldap/servers/slapd/back-ldbm/id2entry.c Descriptino: When deleting an entry, if the dn is in the dn cache, it should be removed. The original code was trying to remove it regardless of the existence in the dn cache. Fixed it so that only when the dn is in the cache, it's removed.
Comment on attachment 395555 [details] git patch file tested on rhel5 - no assertions
Thanks to Rich for his review and running the test. Pushed to master. $ git merge replication Updating 4205086..c26ba79 Fast forward ldap/servers/slapd/back-ldbm/id2entry.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) $ git push Counting objects: 13, done. Delta compression using 4 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 837 bytes, done. Total 7 (delta 5), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git 4205086..c26ba79 master -> master
ASSERT is enabled only when the ds is built with --enable-debug. I rebuilt the server with --enable-debug, and ran delete operations. The assertion did not fail.