[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#2774
This is a multi-part message in MIME format.
------=_NextPart_000_001A_01C3AF47.1010EF70
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_001B_01C3AF47.1010EF70"
------=_NextPart_001_001B_01C3AF47.1010EF70
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
FYI - this patch seemed to sort my problem out. I don't know why
ldap_pvt_thread_cond_wait() wasn't waking up when the thread was
signaled. Maybe a bug in pthreads? (I was using v10 as included with
RedHat9). This could be extended to timeout idle threads but I didn't
have time to add that functionality.
--- libraries/libldap_r/tpool.c.orig 2003-10-27 19:52:44.000000000
-0500
+++ libraries/libldap_r/tpool.c 2003-10-27 19:56:53.000000000 -0500
@@ -408,8 +408,21 @@
* check timer, leave thread (break;)
*/
- if (pool->ltp_state ==
LDAP_INT_THREAD_POOL_RUNNING)
-
ldap_pvt_thread_cond_wait(&pool->ltp_cond, &pool->ltp_mutex);
+ if (pool->ltp_state ==
LDAP_INT_THREAD_POOL_RUNNING) {
+
//ldap_pvt_thread_cond_wait(&pool->ltp_cond, &pool->ltp_mutex);
+ struct timespec to;
+ memset(&to, 0, sizeof to);
+ to.tv_sec = time(0) + 60;
+ to.tv_nsec = 0;
+ // syslog( ldap_syslog_level, "thread %d
waiting for signal\n", ldap_pvt_thread_self());
+ int rc =
pthread_cond_timedwait(&pool->ltp_cond, &pool->ltp_mutex, &to);
+ // Should be able to let this idle
thread die. TODO: Fix bug that makes slapd crash if we do this
+ // if( (rc == ETIMEDOUT) &&
(pool->ltp_open_count > 1) && (pool->ltp_starting == 0) ) {
+ // syslog( ldap_syslog_level,
"thread %d timed out due to inactivity\n", ldap_pvt_thread_self());
+ // break;
+ // }
+ // syslog( ldap_syslog_level, "thread %d
got signal %d\n", ldap_pvt_thread_self(), rc);
+ }
continue;
}
John Matthews
CROSSML
Phone: 1300 305 110
------=_NextPart_001_001B_01C3AF47.1010EF70
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
FYI - this patch seemed to sort my problem out. I = don?t know why ldap_pvt_thread_cond_wait() wasn?t waking up when the = thread was signaled. Maybe a bug in pthreads? (I was using v10 as included with = RedHat9). This could be extended to timeout idle threads but I didn?t have = time to add that functionality.
--- = libraries/libldap_r/tpool.c.orig 2003-10-27 19:52:44.000000000 -0500
+++ libraries/libldap_r/tpool.c 2003-10-27 19:56:53.000000000 -0500
@@ -408,8 +408,21 @@
= &=
nbsp; * check timer, leave thread = (break;)
= */
- = ; = if (pool->ltp_state =3D=3D = LDAP_INT_THREAD_POOL_RUNNING)
- = ; = ldap_pvt_thread_cond_wait(&pool->ltp_cond, = &pool->ltp_mutex);
+ = ; = if (pool->ltp_state =3D=3D LDAP_INT_THREAD_POOL_RUNNING) = {
+ = ; = //ldap_pvt_thread_cond_wait(&pool->ltp_cond, = &pool->ltp_mutex);
+ = ; = struct timespec to;
+ = ; = memset(&to, 0, sizeof to);
+ = ; = to.tv_sec =3D time(0) + 60;
+ = ; = to.tv_nsec =3D 0;
+ = ; = // syslog( ldap_syslog_level, "thread %d waiting for = signal\n", ldap_pvt_thread_self());
+ = ; = int rc =3D pthread_cond_timedwait(&pool->ltp_cond, = &pool->ltp_mutex, &to);
+ = ; = // Should be able to let this idle thread die. TODO: Fix bug that makes = slapd crash if we do this
+ = ; /= / if( (rc =3D=3D ETIMEDOUT) && (pool->ltp_open_count > 1) = && (pool->ltp_starting =3D=3D 0) ) {
+ = ; = &=
nbsp; // syslog( ldap_syslog_level, "thread %d timed out due to inactivity\n", ldap_pvt_thread_self());
+ = ; &=
nbsp; // break;
+ = ; = // }
+ = ; = // syslog( ldap_syslog_level, "thread %d got signal %d\n", = ldap_pvt_thread_self(), rc);
+ = ; = }
= &=
nbsp; continue;
= }
John Matthews
CROSSML
Phone: 1300 305 110
------=_NextPart_001_001B_01C3AF47.1010EF70--
------=_NextPart_000_001A_01C3AF47.1010EF70
Content-Type: image/gif;
name="image001.gif"
Content-Transf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