Bug 563365

Summary: Error handling problems in the backend functions
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: jgalipea
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:30:50 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: 434914    
Attachments:
Description Flags
git patch file
nkinder: review+
git patch file (Directory_Server_8_2_Branch)
none
steps in gdb for add operation none

Description Noriko Hosoi 2010-02-09 23:48:24 UTC
Description of problem:
1) Error handling in ldbm_back_{add,delete,modify,modrdn} functions was incomplete.  When any error occurs after the transaction begins, the changes made after that should be aborted.  There were some cases the abort was not called.
2) If modrdn failed in ldbm_bacK_modrdn, new DN in the DN cache was not removed.

Comment 1 Noriko Hosoi 2010-02-09 23:55:35 UTC
Created attachment 389871 [details]
git patch file

Files:
   ldap/servers/slapd/back-ldbm/id2entry.c
   ldap/servers/slapd/back-ldbm/ldbm_add.c
   ldap/servers/slapd/back-ldbm/ldbm_delete.c
   ldap/servers/slapd/back-ldbm/ldbm_modify.c
   ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
   ldap/servers/slapd/libglobs.c

Description:
1) modified the code so that the changes are aborted if an error is detected in back_ldbm_{add,delete,modify,modrdn}.
2) ldap_back_modrdn deletes DN from the DN cache if the modrdn operation failed.
3) config_set_instancedir has the explicit function type int.

Comment 2 Noriko Hosoi 2010-02-10 01:27:53 UTC
Created attachment 389879 [details]
git patch file (Directory_Server_8_2_Branch)

Files:
 ldap/servers/slapd/back-ldbm/ldbm_add.c
 ldap/servers/slapd/back-ldbm/ldbm_delete.c
 ldap/servers/slapd/back-ldbm/ldbm_modify.c
 ldap/servers/slapd/back-ldbm/ldbm_modrdn.c

Description:
Back ported (1) in the 9.0 fix to 8.2.
1) Error handling in ldbm_back_{add,delete,modify,modrdn} functions was
incomplete.  When any error occurs after the transaction begins, the
changes made after that should be aborted.  There were some cases the
abort was not called.

Comment 3 Noriko Hosoi 2010-02-11 01:24:38 UTC
Reviewed by Nathan (Thank you!!)

Pushed to master as well as Directory_Server_8_2_Branch.

[master]
$ git merge work
Updating f81e7ea..508af98
Fast forward
 ldap/servers/slapd/back-ldbm/id2entry.c    |    2 +-
 ldap/servers/slapd/back-ldbm/ldbm_add.c    |   67 +++++++++++----------------
 ldap/servers/slapd/back-ldbm/ldbm_delete.c |   53 +++++++++++++++------
 ldap/servers/slapd/back-ldbm/ldbm_modify.c |   19 +++++--
 ldap/servers/slapd/back-ldbm/ldbm_modrdn.c |   69 +++++++++++++++++++++-------
 ldap/servers/slapd/libglobs.c              |    1 +
 6 files changed, 132 insertions(+), 79 deletions(-)
$ git push
Counting objects: 23, done.
Delta compression using 4 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 2.86 KiB, done.
Total 12 (delta 10), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   f81e7ea..508af98  master -> master

[Directory_Server_8_2_Branch]
$ git push origin ds82-local:Directory_Server_8_2_Branch
Counting objects: 19, done.
Delta compression using 4 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 2.30 KiB, done.
Total 10 (delta 8), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   0fc8628..1ae9a08  ds82-local -> Directory_Server_8_2_Branch

Comment 5 Jenny Severance 2010-06-04 16:35:39 UTC
can you please add steps to verify - thanks!

Comment 6 Noriko Hosoi 2010-06-04 17:29:24 UTC
I'm afraid there are no simple steps to verify this bug.  I ran into this bug when I was working on the subtree rename project.  While the new entryrdn index code was half-baked, it returned unexpected errors and I found the parent functions listed above failed to abort the update request.  Now we cannot expect such failures.  (Plus 8.2 does not include the subtree rename code.)

I would run some update operations against the server attached to the debugger, break in the listed functions and force to take an abort path by setting an error code to some return values.  I guess it's out of QE's interest. :)  If you don't mind, let me verify this bug.

Comment 7 Jenny Severance 2010-06-04 17:45:22 UTC
please do :-)  Thanks Noriko!

Comment 8 Noriko Hosoi 2010-06-04 18:20:56 UTC
Created attachment 421319 [details]
steps in gdb for add operation

Once a fake error code is set, the add operation is correctly aborted.  I also verified that modify, modrdn, and delete work fine.