#50239 Ticket 50238 - Failed modrdn can corrupt entry cache
Closed by spichugi. Opened by mreynolds.
mreynolds/389-ds-base ticket50238  into  master

Download 50239.patch

Bug Description:

Under certain conditions (found under IPA) when a backend
transaction plugin fails and causes a modrdn operation to
fail the entry cache no longer contains the original/pre
entry, but instead it has the post modrdn'ed entry with
the original entry's ID

Fix Description:

Upon failure, if the post entry is in the cache, then swap
it out with the original entry.

https://pagure.io/389-ds-base/issue/50238

rebased onto f0e46d1559f6db97a99453ce072459dcb794b1c5

Add CI test, but I can not reproduce the original issue where the original entry is not in the cache after the failed modrdn. but the CI test found a different bug that is now also fixed: without the fix the CI test leaves the failed modrdn entry in the cache.

So with the fix the failed modrdn entry is not in the cache, and the original entry is in the cache. I just can't reproduce the issue where the original entry is not in the cache after the failed modrdn (at least not outside of an IPA deployment).

Don't need to catch this, just let the exception raise.

with pytest.raises(ldap.OBJECTCLASS_VIOLATION)
do this thing

with pytest.raises ...

Okay, that's fine. Some comments on the testcase

The test reaches that point and fails here... 389-ds-base-1.4.1.1-20190225gitf0e46d155.fc29.x86_64

The test reaches that point and fails here... 389-ds-base-1.4.1.1-20190225gitf0e46d155.fc29.x86_64

Sorry this PR assumes my previous PR was applied:

https://pagure.io/389-ds-base/pull-request/50237

When it is, the correct error code is caught... I'll get that other PR fixed, and reviewed again, then I we should retest this CI test

rebased onto 566ac8861e201523d3e0d9651b90242c29959617

It looks to me the cache_replace will do similar job as CACHE_RETURN did on 'ec'.
In addition it adds back 'e' (old entry) into the entry cache. Is it what was missing ('e' in entry cache) and explaining the crash ?

It looks to me the cache_replace will do similar job as CACHE_RETURN did on 'ec'.
In addition it adds back 'e' (old entry) into the entry cache. Is it what was missing ('e' in entry cache) and explaining the crash ?

This does not fix the crash because I can not reproduce the crash. And that is actually a completely different issue.

The issue here is that a failed modrdn leaves the original entry out of the cache, and the failed mordrdn in its place. We need to revert it

Thanks @mreynolds for the explanation. I think the previous code should have remove the failed modrdn from the cache but I agree it is good to return the original in the entry cache.
the patch looks okay to me and you have my ACK

@mreynolds
I can confirm that this PR & #50237 fixed my issue.

Thank you

rebased onto b30295a7b2e3d7cae47348a1df2f32adc5be7397

Pull-Request has been merged by mreynolds

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 pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3298

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata