Bug 567370 - dncache: assertion failure in id2entry_delete
Summary: dncache: assertion failure in id2entry_delete
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Database - General
Version: 1.3.0
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 639035
TreeView+ depends on / blocked
 
Reported: 2010-02-22 18:54 UTC by Noriko Hosoi
Modified: 2015-12-07 16:55 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-07 16:55:00 UTC


Attachments (Terms of Use)
git patch file (1.70 KB, patch)
2010-02-22 20:02 UTC, Noriko Hosoi
nhosoi: review?
rmeggins: review+
Details | Diff

Description Noriko Hosoi 2010-02-22 18:54:45 UTC
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);
               }
           }
       }

Comment 1 Noriko Hosoi 2010-02-22 19:48:32 UTC
The previous problem was reported by rmeggins@redhat.com.  (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.

Comment 2 Noriko Hosoi 2010-02-22 20:02:51 UTC
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 3 Rich Megginson 2010-02-22 20:28:00 UTC
Comment on attachment 395555 [details]
git patch file

tested on rhel5 - no assertions

Comment 4 Noriko Hosoi 2010-02-22 20:30:52 UTC
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

Comment 6 Noriko Hosoi 2011-07-20 21:34:43 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.