Bug 567370

Summary: dncache: assertion failure in id2entry_delete
Product: [Retired] 389 Reporter: Noriko Hosoi <nhosoi>
Component: Database - GeneralAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: low    
Version: 1.3.0CC: amsharma, rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 16:55:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 639035    
Attachments:
Description Flags
git patch file nhosoi: review?, rmeggins: review+

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.  (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.