Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 200321 Details for
Bug 240897
CRM 1474928 : ds7.1 db index/vlv not handling a stop-slapd, hangs slapd
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
cvs diffs
240897.diff (text/plain), 13.25 KB, created by
Noriko Hosoi
on 2007-09-20 00:43:51 UTC
(
hide
)
Description:
cvs diffs
Filename:
MIME Type:
Creator:
Noriko Hosoi
Created:
2007-09-20 00:43:51 UTC
Size:
13.25 KB
patch
obsolete
>Index: libglobs.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libglobs.c,v >retrieving revision 1.20 >diff -t -w -U4 -r1.20 libglobs.c >--- libglobs.c 17 Sep 2007 22:48:10 -0000 1.20 >+++ libglobs.c 19 Sep 2007 22:34:35 -0000 >@@ -734,8 +734,31 @@ > return newlist; > } > > /* >+ * counter for active threads >+ */ >+int active_threads = 0; >+ >+void >+g_incr_active_threadcnt() >+{ >+ PR_AtomicIncrement(&active_threads); >+} >+ >+void >+g_decr_active_threadcnt() >+{ >+ PR_AtomicDecrement(&active_threads); >+} >+ >+int >+g_get_active_threadcnt() >+{ >+ return active_threads; >+} >+ >+/* > ** Setting this flag forces the server to shutdown. > */ > static int slapd_shutdown; > >Index: proto-slap.h >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v >retrieving revision 1.28 >diff -t -w -U4 -r1.28 proto-slap.h >--- proto-slap.h 11 Jul 2007 01:14:05 -0000 1.28 >+++ proto-slap.h 19 Sep 2007 22:34:35 -0000 >@@ -202,8 +202,11 @@ > int g_get_defsize(); > int g_get_deftime(); > void be_unbindall( Connection *conn, Operation *op); > int be_nbackends_public(); >+void g_incr_active_threadcnt(); >+void g_decr_active_threadcnt(); >+int g_get_active_threadcnt(); > > /* > * bind.c > */ >Index: connection.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/connection.c,v >retrieving revision 1.16 >diff -t -w -U4 -r1.16 connection.c >--- connection.c 14 May 2007 22:04:55 -0000 1.16 >+++ connection.c 19 Sep 2007 22:34:35 -0000 >@@ -401,9 +401,9 @@ > int prerr = PR_GetError(); > LDAPDebug( LDAP_DEBUG_ANY, "PR_CreateThread failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n", > prerr, slapd_pr_strerror( prerr ), 0 ); > } else { >- PR_AtomicIncrement(&active_threads); >+ g_incr_active_threadcnt(); > } > } > } > >@@ -745,9 +745,9 @@ > connection_decrement_reference(conn); > } > } > } >- PR_AtomicDecrement(&active_threads); >+ g_decr_active_threadcnt(); > } > > static int handle_read_data(Connection *conn,Operation **op, > int * connection_referenced) >@@ -1947,11 +1947,13 @@ > However, if no activity on all the connections, then every connection gets 0 rank, so none move out. > No bother to do so much calcuation, short-cut to non-turbo mode if no activities in passed interval */ > new_mode = 0; > } else { >+ double activet = 0.0; > connection_find_our_rank(conn,&connection_count, &our_rank); > LDAPDebug(LDAP_DEBUG_CONNS,"conn %d turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count); >- threshold_rank = (int)((double)active_threads * ((double)CONN_TURBO_PERCENTILE / 100.0) ); >+ activet = (double)g_get_active_threadcnt(); >+ threshold_rank = (int)(activet * ((double)CONN_TURBO_PERCENTILE / 100.0)); > > /* adjust threshold_rank according number of connections, > less turbo threads as more connections, > one measure to reduce thread startvation. >@@ -2022,9 +2024,9 @@ > > if( op_shutdown ) { > LDAPDebug( LDAP_DEBUG_TRACE, > "op_thread received shutdown signal\n", 0, 0, 0 ); >- PR_AtomicDecrement(&active_threads); >+ g_decr_active_threadcnt(); > return; > } > > if (!thread_turbo_flag && (NULL == pb) && !more_data) { >@@ -2038,9 +2040,9 @@ > continue; > case CONN_SHUTDOWN: > LDAPDebug( LDAP_DEBUG_TRACE, > "op_thread received shutdown signal\n", 0, 0, 0 ); >- PR_AtomicDecrement(&active_threads); >+ g_decr_active_threadcnt(); > return; > case CONN_FOUND_WORK_TO_DO: > default: > break; >@@ -2101,9 +2103,9 @@ > goto done; > case CONN_SHUTDOWN: > LDAPDebug( LDAP_DEBUG_TRACE, > "op_thread received shutdown signal\n", 0, 0, 0 ); >- PR_AtomicDecrement(&active_threads); >+ g_decr_active_threadcnt(); > return; > default: > break; > } >@@ -2332,9 +2334,9 @@ > PR_Unlock( op_thread_lock ); > #ifdef _WIN32 > LDAPDebug( LDAP_DEBUG_ANY, > "slapd shutting down - waiting for %d threads to terminate\n", >- active_threads, 0, 0 ); >+ g_get_active_threadcnt(), 0, 0 ); > /* kill off each worker waiting on GetQueuedCompletionStatus */ > for ( i = 0; i < max_threads; ++ i ) > { > PostQueuedCompletionStatus( completion_port, 0, COMPKEY_DIE ,0); >Index: daemon.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/daemon.c,v >retrieving revision 1.14 >diff -t -w -U4 -r1.14 daemon.c >--- daemon.c 3 Aug 2007 22:14:41 -0000 1.14 >+++ daemon.c 19 Sep 2007 22:34:35 -0000 >@@ -806,17 +806,18 @@ > op_thread_cleanup(); > housekeeping_stop(); /* Run this after op_thread_cleanup() logged sth */ > > #ifndef _WIN32 >- if ( active_threads > 0 ) { >+ threads = g_get_active_threadcnt(); >+ if ( threads > 0 ) { > LDAPDebug( LDAP_DEBUG_ANY, > "slapd shutting down - waiting for %d thread%s to terminate\n", >- active_threads, ( active_threads > 1 ) ? "s" : "", 0 ); >+ threads, ( threads > 1 ) ? "s" : "", 0 ); > } > #endif > >- threads = active_threads; >- while ( active_threads > 0 ) { >+ threads = g_get_active_threadcnt(); >+ while ( threads > 0 ) { > PRPollDesc xpd; > char x; > int spe = 0; > >@@ -844,13 +845,13 @@ > } else { > /* no data */ > } > DS_Sleep(PR_INTERVAL_NO_WAIT); >- if ( threads != active_threads ) { >+ if ( threads != g_get_active_threadcnt() ) { > LDAPDebug( LDAP_DEBUG_TRACE, > "slapd shutting down - waiting for %d threads to terminate\n", >- active_threads, 0, 0 ); >- threads = active_threads; >+ g_get_active_threadcnt(), 0, 0 ); >+ threads = g_get_active_threadcnt(); > } > } > > LDAPDebug( LDAP_DEBUG_ANY, >@@ -1246,9 +1247,9 @@ > > snmp_collator_update(); > > prevtime = curtime; >- num_active_threads = active_threads; >+ num_active_threads = g_get_active_threadcnt(); > if ( (num_active_threads == 0) || > (difftime(curtime, housekeeping_fire_time) >= > slapd_housekeeping_timer*3) ) { > housekeeping_fire_time = curtime; >Index: task.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/task.c,v >retrieving revision 1.12 >diff -t -w -U4 -r1.12 task.c >--- task.c 7 Sep 2007 19:08:45 -0000 1.12 >+++ task.c 19 Sep 2007 22:34:35 -0000 >@@ -614,8 +614,9 @@ > int rv = -1; > int count; > Slapi_Task *task = pb->pb_task; > >+ g_incr_active_threadcnt(); > for (count = 0, inp = instance_names; *inp; inp++, count++) > ; > task->task_work = count; > task->task_progress = 0; >@@ -713,8 +714,9 @@ > > task->task_exitcode = rv; > task->task_state = SLAPI_TASK_FINISHED; > slapi_task_status_changed(task); >+ g_decr_active_threadcnt(); > } > > static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e, > Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) >@@ -954,8 +956,9 @@ > Slapi_PBlock *pb = (Slapi_PBlock *)arg; > Slapi_Task *task = pb->pb_task; > int rv; > >+ g_incr_active_threadcnt(); > task->task_work = 1; > task->task_progress = 0; > task->task_state = SLAPI_TASK_RUNNING; > slapi_task_status_changed(task); >@@ -982,8 +985,9 @@ > slapi_task_status_changed(task); > > slapi_ch_free((void **)&pb->pb_seq_val); > slapi_pblock_destroy(pb); >+ g_decr_active_threadcnt(); > } > > static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e, > Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) >@@ -1098,8 +1102,9 @@ > Slapi_PBlock *pb = (Slapi_PBlock *)arg; > Slapi_Task *task = pb->pb_task; > int rv; > >+ g_incr_active_threadcnt(); > task->task_work = 1; > task->task_progress = 0; > task->task_state = SLAPI_TASK_RUNNING; > slapi_task_status_changed(task); >@@ -1126,8 +1131,9 @@ > slapi_task_status_changed(task); > > slapi_ch_free((void **)&pb->pb_seq_val); > slapi_pblock_destroy(pb); >+ g_decr_active_threadcnt(); > } > > static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e, > Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) >@@ -1250,8 +1256,9 @@ > Slapi_PBlock *pb = (Slapi_PBlock *)arg; > Slapi_Task *task = pb->pb_task; > int rv; > >+ g_incr_active_threadcnt(); > task->task_work = 1; > task->task_progress = 0; > task->task_state = SLAPI_TASK_RUNNING; > slapi_task_status_changed(task); >@@ -1270,8 +1277,9 @@ > > charray_free(pb->pb_db2index_attrs); > slapi_ch_free((void **)&pb->pb_instance_name); > slapi_pblock_destroy(pb); >+ g_decr_active_threadcnt(); > } > > static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e, > Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) >Index: monitor.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/monitor.c,v >retrieving revision 1.6 >diff -t -w -U4 -r1.6 monitor.c >--- monitor.c 10 Nov 2006 23:45:40 -0000 1.6 >+++ monitor.c 19 Sep 2007 22:34:35 -0000 >@@ -85,9 +85,9 @@ > val.bv_len = strlen( val.bv_val ); > attrlist_replace( &e->e_attrs, "version", vals ); > slapi_ch_free( (void **) &val.bv_val ); > >- sprintf( buf, "%d", active_threads ); >+ sprintf( buf, "%d", g_get_active_threadcnt() ); > val.bv_val = buf; > val.bv_len = strlen( buf ); > attrlist_replace( &e->e_attrs, "threads", vals ); > >Index: psearch.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/psearch.c,v >retrieving revision 1.8 >diff -t -w -U4 -r1.8 psearch.c >--- psearch.c 10 Nov 2006 23:45:40 -0000 1.8 >+++ psearch.c 19 Sep 2007 22:34:35 -0000 >@@ -294,9 +294,9 @@ > char *fstr = NULL; > char **pbattrs = NULL; > int conn_acq_flag = 0; > >- PR_AtomicIncrement( &active_threads ); >+ g_incr_active_threadcnt(); > > /* need to acquire a reference to this connection so that it will not > be released or cleaned up out from under us */ > PR_Lock( ps->ps_pblock->pb_conn->c_mutex ); >@@ -442,9 +442,9 @@ > peqnext = peq->pe_next; > pe_ch_free( &peq ); > } > slapi_ch_free((void **) &ps ); >- PR_AtomicDecrement(&active_threads); >+ g_decr_active_threadcnt(); > } > > > >Index: fe.h >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/fe.h,v >retrieving revision 1.7 >diff -t -w -U4 -r1.7 fe.h >--- fe.h 3 Aug 2007 22:14:41 -0000 1.7 >+++ fe.h 19 Sep 2007 22:34:35 -0000 >@@ -55,9 +55,8 @@ > extern __declspec(dllimport) int slapd_ldap_debug; > #endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */ > #endif > #endif >-extern int active_threads; > extern PRInt32 ops_initiated; > extern PRInt32 ops_completed; > extern PRLock *ops_mutex; > extern PRThread *listener_tid; >Index: globals.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/globals.c,v >retrieving revision 1.6 >diff -t -w -U4 -r1.6 globals.c >--- globals.c 10 Nov 2006 23:45:40 -0000 1.6 >+++ globals.c 19 Sep 2007 22:34:35 -0000 >@@ -87,16 +87,14 @@ > > /* > * global variables that need mutex protection > */ >-int active_threads; > PRInt32 ops_initiated; > PRInt32 ops_completed; > PRLock *ops_mutex; > int num_conns; > PRLock *num_conns_mutex; > >- > /* > DEC/COMPAQ has released a patch for 4.0d (e?) which will speed up > malloc/free considerably in multithreaded multiprocessor > applications (like directory server!), sort of like SmartHeap but
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240897
: 200321 |
200931
|
200941