[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#7222) Slapd hangs on high load
This is a multi-part message in MIME format.
--------------040402080004020608060006
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On 09.04.2012 20:09, Hrvoje HabjaniÄ? wrote:
>
> Hi.
>
> Two more "hang"s, both in sched_yield(). This is with replacement malloc
> (tcmalloc, minimal).
>
> http://free-zg.t-com.hr/HrvojeHabjanic/openldap/hang4.log
> http://free-zg.t-com.hr/HrvojeHabjanic/openldap/hang5.log
>
> H.
Hi.
Attached patch if solving my proglem with "hang" in sched_yield.
In general, i do think that there (cache management) is a lot of
unnecessary locking and waiting ... And simplifying things there would
solve a lot of problems ... Probably. :-)
Of course, i'm not shure how will this change influence the rest of the
code, but it does work for me (tm).
H.
p.s. Also available at
http://free-zg.t-com.hr/HrvojeHabjanic/openldap/ol.diff
--------------040402080004020608060006
Content-Type: text/x-patch;
name="ol.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="ol.diff"
diff -Nru openldap-d7d1789-org/servers/slapd/back-bdb/cache.c openldap-d7d1789/servers/slapd/back-bdb/cache.c
--- openldap-d7d1789-org/servers/slapd/back-bdb/cache.c 2012-04-10 00:47:23.000000000 +0200
+++ openldap-d7d1789/servers/slapd/back-bdb/cache.c 2012-04-11 10:23:43.267461183 +0200
@@ -1361,7 +1361,7 @@
DB_LOCK *lock )
{
EntryInfo *ei = BEI(e);
- int rc, busy = 0;
+ int rc, busy = 0, counter = 0;
assert( e->e_private != NULL );
@@ -1378,7 +1378,7 @@
bdb_cache_entryinfo_unlock( ei );
- while ( busy ) {
+ while ( busy && counter < 1000) {
ldap_pvt_thread_yield();
busy = 0;
bdb_cache_entryinfo_lock( ei );
@@ -1387,6 +1387,13 @@
ei->bei_finders > 0 )
busy = 1;
bdb_cache_entryinfo_unlock( ei );
+ counter ++;
+ }
+ if( busy ) {
+ bdb_cache_entryinfo_lock( ei );
+ ei->bei_state ^= CACHE_ENTRY_DELETED;
+ bdb_cache_entryinfo_unlock( ei );
+ return DB_LOCK_DEADLOCK;
}
/* Get write lock on the data */
--------------040402080004020608060006--