[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: FW: daemon: select timeout - yielding



I believe that will prevent the global idletimeout from working correctly. tvp should only be set to NULL if *tvp is all zeros. Then everything should be fine.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support

-----Original Message-----
From: Jonghyuk Choi [mailto:jongchoi@us.ibm.com]
Sent: Friday, June 06, 2003 2:39 PM
To: Kurt D. Zeilenga
Cc: Howard Chu; openldap-devel@OpenLDAP.org
Subject: Re: FW: daemon: select timeout - yielding


It would be ok to just restore the following lines.
The update of tvp inside #ifdef LDAP_SYNCREPL is for the
case when a scheduled task is to be run. tvp will not change
there otherwise.

+#if defined( HAVE_YIELDING_SELECT) || defined( NO_THREADS )
+                tvp = NULL;
+#else
                tvp = at ? &tv : NULL;
+#endif

#ifdef LDAP_SYNCREPL
                ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
                rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
                while ( cat && cat->tv_sec && cat->tv_sec <= now ) {
                        if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
                                ldap_pvt_runqueue_resched( &syncrepl_rq, rtask );
                        } else {
                                ldap_pvt_runqueue_runtask( &syncrepl_rq, rtask );
                                ldap_pvt_runqueue_resched( &syncrepl_rq, rtask );
                                ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
                                ldap_pvt_thread_pool_submit( &connection_pool,
                                                                                        rtask->routine, (void *) rtask );
                        }
                        rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
                }
                rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
                ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );

                if ( cat != NULL ) {
                        time_t diff = difftime( cat->tv_sec, now );
                        if ( diff == 0 )
                                diff = tdelta;
                        if ( tvp == NULL || diff < tv.tv_sec ) {
                                tv.tv_sec = diff;
                                tv.tv_usec = 0;
                                tvp = &tv;
                        }
                }
#endif

------------------------
Jong Hyuk Choi
IBM Thomas J. Watson Research Center - Enterprise Linux Group
P. O. Box 218, Yorktown Heights, NY 10598
email: jongchoi@us.ibm.com
(phone) 914-945-3979    (fax) 914-945-4425   TL: 862-3979



"Kurt D. Zeilenga" <Kurt@OpenLDAP.org>
Sent by: owner-openldap-devel@OpenLDAP.org

06/06/2003 02:32 PM

       
        To:        "Howard Chu" <hyc@highlandsun.com>
        cc:        <openldap-devel@OpenLDAP.org>
        Subject:        Re: FW: daemon: select timeout - yielding



Some select(2) calls don't yield to other threads when blocked,
causing the whole server to block waiting for select(2) to return.
The code use to only use the poll when HAVE_YIELDING_SELECT was
not set.  I'm not sure why we now poll all the time.  That's not
needed.

Kurt

At 11:01 AM 6/6/2003, Howard Chu wrote:
>This bit in daemon.c about polling (select with a timeval of 0 sec/ 0 usec)
>when there
>are active threads doesn't make a whole lot of sense to me. The behavior was
>in the
>original code and I preserved it when I wrote the idletimeout patch. What is
>it
>intended to accomplish?
>
>  -- Howard Chu
>  Chief Architect, Symas Corp.       Director, Highland Sun
>  http://www.symas.com               http://highlandsun.com/hyc
>  Symas: Premier OpenSource Development and Support
>
>-----Original Message-----
>From: owner-openldap-software@OpenLDAP.org
>[mailto:owner-openldap-software@OpenLDAP.org]On Behalf Of Alexander
>Lunyov
>Sent: Friday, June 06, 2003 8:44 AM
>To: openldap-software@OpenLDAP.org
>Subject: daemon: select timeout - yielding
>
>
>Hello openldap-software,
>
>  FreeBSD 4.8R
>  Cyrus-IMAPD-2.1.13 (from ports)
>  Cyrus-SASL-2.1.13 (from ports with ldapdb.c patch)
>  auxprop plugin ldapdb.c patch from Edward Rudd (it was 05.06.2003)
>
>  Can somebody explain to me why slapd when i'm trying to authenticate
>  with DIGEST-MD5 (Cyrus-SASL-2.1.13) hangs? For example, after
>  command "cyradm --user cyradm localhost" and after i enter password,
>  or after command "ldapsearch -U someuser" BUT BEFORE i enter the
>  password (in ldapsearch case it even not asking for password),
>  in logs i see that slapd starts authentication and then -
>  "select timeout" and logs are growing very-very fast.
>
>  ldap part of IMAP config:
>
>sasl_pwcheck_method: auxprop
>sasl_ldapdb_uri: ldap://127.0.0.1
>sasl_ldapdb_id:  admin
>sasl_ldapdb_pw: password
>sasl_ldapdb_mech: DIGEST-MD5
>
>  Auth via sasldb2 is working, everything is fine.
>
>  Log:
>
>Jun  6 19:22:24 icarus slapd[87577]: daemon: activity on 1 descriptors
>Jun  6 19:22:24 icarus slapd[87577]: daemon: new connection on 9
>Jun  6 19:22:24 icarus slapd[87577]: conn=1 fd=9 ACCEPT from
>IP=127.0.0.1:2587 (IP=0.0.0.0:389)
>Jun  6 19:22:24 icarus slapd[87577]: daemon: added 9r
>Jun  6 19:22:24 icarus slapd[87577]: daemon: activity on:
>Jun  6 19:22:24 icarus slapd[87577]:
>Jun  6 19:22:24 icarus slapd[87577]: daemon: select: listen=8
>active_threads=0 tvp=NULL
>Jun  6 19:22:24 icarus slapd[87577]: daemon: activity on 1 descriptors
>Jun  6 19:22:24 icarus slapd[87577]: daemon: activity on:
>Jun  6 19:22:24 icarus slapd[87577]:  9r
>Jun  6 19:22:24 icarus slapd[87577]:
>Jun  6 19:22:24 icarus slapd[87577]: daemon: read activity on 9
>Jun  6 19:22:24 icarus slapd[87577]: connection_get(9)
>Jun  6 19:22:24 icarus slapd[87577]: connection_get(9): got connid=1
>Jun  6 19:22:24 icarus slapd[87577]: connection_read(9): checking for input
>on id=1
>Jun  6 19:22:24 icarus slapd[87577]: ber_get_next on fd 9 failed errno=35
>(Resource temporarily unavailable)
>Jun  6 19:22:24 icarus slapd[87577]: do_bind
>Jun  6 19:22:24 icarus slapd[87577]: >>> dnPrettyNormal: <>
>Jun  6 19:22:24 icarus slapd[87577]: <<< dnPrettyNormal: <>, <>
>Jun  6 19:22:24 icarus slapd[87577]: do_sasl_bind: dn () mech DIGEST-MD5
>Jun  6 19:22:24 icarus slapd[87577]: conn=1 op=0 BIND dn="" method=163
>Jun  6 19:22:24 icarus slapd[87577]: ==> sasl_bind: dn="" mech=DIGEST-MD5
>datalen=0
>Jun  6 19:22:24 icarus slapd[87577]: SASL [conn=1] Debug: DIGEST-MD5 server
>step 1
>Jun  6 19:22:24 icarus slapd[87577]: daemon: select: listen=8
>active_threads=1 tvp=idle
>Jun  6 19:22:24 icarus slapd[87577]: daemon: select timeout - yielding
>Jun  6 19:22:24 icarus slapd[87577]: daemon: select: listen=8
>active_threads=1 tvp=idle
>.
>.
>.
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select timeout - yielding
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select: listen=8

>active_threads=1 tvp=idle
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select timeout - yielding
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select: listen=8
>active_threads=1 tvp=idle
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select timeout - yielding
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select: listen=8
>active_threads=1 tvp=idle
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select timeout - yielding
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select: listen=8
>active_threads=1 tvp=idle
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select timeout - yielding
>Jun  6 19:25:55 icarus slapd[87577]: daemon: select: listen=8
>active_threads=1 tvp=idle
>
>
>
>p.s.: or maybe i should ask it in cyrus-sasl@ ?
>
>--
>Best regards,
>Alexander                          mailto:lan_mailing@startatom.ru