#47404 ruv modify context problem with cache_replace
Closed: wontfix None Opened 10 years ago by rmeggins.

This causes errors like this in the errors log:

ldbm_back_add: modify_switch_entries failed
and
ldbm_back_modify: modify_switch_entries failed

The problem is that the struct _modify_context->old_entry can be removed from the cache between the call to ldbm_txn_ruv_modify_context() and the call to modify_switch_entries(), by a BETXN PRE Op plugin. Consider the following:

outer add:
ldbm_txn_ruv_modify_context:
mc->old_e = cached RUV ID = N DN = A
mc->new_e = not cached
  betxnpreop - inner mod
  ldbm_txn_ruv_modify_context:
  mc->old_e = cached RUV ID = N DN = A # points to same cache entry as above old_e
  mc->new_e = not cached
  ... do op - call modify_update_all()
  ... success ...
  modify_switch_entries - cache_replace old_e, new_e
    delete RUV ID from ID hash
    delete RUV DN from DN hash
    add new_e to RUV ID hash
    add new_e to RUV DN hash
    mark old_e as DELETED
    new_e refcnt == 1 # NOTE: should this be new_e refcnt = old_e refcnt instead?
  cache_return new_e - entrycache_return
    new_e->refcnt-- # now 0
    if (not DELETED)
      add new_e to lru list
      if (CACHE_FULL) # TRUE - cache is full
        entrycache_flush - iterate through lru list
          entrycache_remove_int new_e
            remove RUV ID from ID hash
            remove RUV DN from DN hash
            mark new_e as DELETED
            # NOTE: at this point, there is no RUV ID or DN in cache!
    backentry_free(new_e)
outer
modify_switch_entries - cache_replace old_e, new_e
  remove_hash RUV ID - FAIL
  remove_hash RUV DN - FAIL
  return 1 - FAIL

This most commonly happens with DNA as DNA is the only BETXN PREOP (in 1.2.11) that modifies the database.
After the call to the BETXN PREOP, we need to make sure mc->old_entry still points to something - not sure how best to do that.


Metadata Update from @rmeggins:
- Issue set to the milestone: N/A

7 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/741

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Duplicate)

3 years ago

Login to comment on this ticket.

Metadata