Bug 240897

Summary: CRM 1474928 : ds7.1 db index/vlv not handling a stop-slapd, hangs slapd
Product: Red Hat Directory Server Reporter: Issue Tracker <tao>
Component: Database - Indexes/SearchesAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: high Docs Contact:
Priority: high    
Version: 7.1CC: msauton, nhosoi, nkinder, rmeggins, sputhenp
Target Milestone: DS8.0   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-06 14:39:48 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: 240316    
Attachments:
Description Flags
cvs diffs
none
cvs diff libglobs.c
none
cvs commit message none

Description Issue Tracker 2007-05-22 18:15:56 UTC
Escalated to Bugzilla from IssueTracker

Comment 11 Rich Megginson 2007-06-04 16:50:12 UTC
(In reply to comment #10)
> BZ Comment #4 Step #8
> 
> Anhy idea why the indexing hung at this stage? I believe this was the root
> cause of all prblems that happened with Hyperion Solutions. It would comes
> as below.

It would seem that there is a bug with creating a browsing index on-line.

> 
> - One admin ran browsing index.
> - It hung. Don't know the reason for the hang, but it's clear from Step
> #8 of Comment #4 that indexing may hang due to "some" reasons.
> - Another admin found database in read-only mode. (At Hyperion more than
> one person has admin access, I guess)
> - Unchecked it. Didn't help. Killed it. Indexing got corruped and found
> an OU missing.
> 
> I see the possibility for another bugzilla which could come from Step #8
> of comment #4.
> 
> Thought?

Yes.  The server should listen for close events and respond.  It seems that in
this case indexing does not respond to the close event.

> 
> --Sadique
> 
> Version set to: '7.1'
> 
> This event sent from IssueTracker by sputhenp 
>  issue 121430
>               



Comment 15 Noriko Hosoi 2007-09-20 00:43:51 UTC
Created attachment 200321 [details]
cvs diffs

Problem analysis:
[..] - Waiting for 4 database threads to stop
[..] - All database threads now stopped
[..] - libdb: DB_TXN->abort: Log undo failed for LSN: 3
1282125: No such file or directory
[..] - libdb: PANIC: No such file or directory
[..] - libdb: Unable to abort transaction 0x8000004b: DB_RUNRECOVERY: Fatal
error, run database recovery
[..] - libdb: PANIC: DB_RUNRECOVERY: Fatal error, run database recovery
[..] - libdb: Error: closing the transaction region with active transactions
[..] - slapd stopped.
Browsing index creation is implemented using task, which spawns a dedicated
task thread to do the task (index creation in this case).  When shutting down,
the server counts the active thread count and when it reaches 0, it closes the
backend db.  The problem here was the task threads were not counted in the
active thread count.  Therefore, the server closed the backend db while the
reindex task thread was still accessing the db index file.

Fix description:
1. moved active thread count from ns-slapd to libslapd for the task threads to
use.
2. provided APIs to increment/decrement/get the active thread count
3. let task threads increment the active thread count when it's spawned and
decrement it when it quits.

Files: ldapserver/ldap/server/slapd/
	    libglobs.c, configdse.c, conntable.c
	    proto-slap.h, connection.c, daemon.c
	    task.c, monitor.c, psearch.c
	    fe.h, globals.c

Comment 16 Rich Megginson 2007-09-20 01:58:42 UTC
I think active_threads needs to be PRInt32 and it should be static.  I think you
can cast it to int in g_decr_active_threadcnt()

Comment 17 Noriko Hosoi 2007-09-20 16:50:57 UTC
Created attachment 200931 [details]
cvs diff libglobs.c

(In reply to comment #16)
> I think active_threads needs to be PRInt32 and it should be static.  I think
you
> can cast it to int in g_decr_active_threadcnt()
Thank you for your comments, Rich.  I've updated libglobs.c.

And this is the correct file list:
Files: ldapserver/ldap/server/slapd/
	    libglobs.c,
	    proto-slap.h, connection.c, daemon.c
	    task.c, monitor.c, psearch.c
	    fe.h, globals.c

Comment 18 Noriko Hosoi 2007-09-20 16:55:33 UTC
Created attachment 200941 [details]
cvs commit message

Reviewed by Rich (Thank you!)

Checked in into HEAD.