timeout in LDAP access

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Jun 18 08:33:00 GMT 2014


On Jun 18 00:41, Denis Excoffier wrote:
> Hi Corinna,
> 
> On 2014-06-17 12:00, Corinna Vinschen wrote:
> > 
> > So I expect an LDAP_SUCCESS with ldap_count_entries() == 0 and then
> > repeat the request.  But the code doesn't expect LDAP_TIMEOUT in this
> > case.  Do I have to handle LDAP_TIMEOUT here as well?
> LDAP_TIMEOUT can occur there. I can even suppose it occurs more
> frequently for the _last_ 100-sid chunk (eg there are 5868 users in
> a domain, and timeout occurs after 5800 and the last 68 get lost). But
> it can also occur after 27 chunks while about 350000 users are still to be
> read in a given domain (yes, that makes about 352700 users in a single domain).
> 
> I’m pretty convinced today that 300 is more than enough,

Much more than enough.  300 seconds?  5 minutes?  For 100 SIDs?

> and that with 3, only
> one or two timeouts are to be expected for an AD with 500000 users and not so
> many domains (50 or 100). The flaw is that as soon as the first timeout occurs,
> the whole rest of the current domain is skipped, which can be much in some cases.
> ldap_get_next_page_s() should perhaps deserve a second chance (with timeout 30s).
> After all, this function is called 3527 times (for the same domain).
> 
> Also a simple observation: if LDAP_TIMEOUT is not to be expected, what is the
> use of this timeval* parameter in ldap_get_next_page_s()?
> 
> > I'm wondering if the timeout, at least for enumerating accounts, should
> > go away entirely.  In case of a connection problem this could result in
> > a hang for about 2 minutes by default I think (LDAP_OPT_PING_LIMIT).
> I think i like this (it it works). But in this case, it will not resume
> to the next domain, and the whole operation (eg getent) is interrupted?

I don't quite understand the question.  All LDAP operations have a
default timeout of 2 minutes if LDAP_OPT_TIMEOUT is not set.  The
operations we're doing here are pretty simple ones, the bunch of 100
SIDs per getpwent LDAP call is a really small dataset (about 4K bytes)
of indexed data, which should be readily available.  And there's a
certain (not Cygwin-specific) expectation that a simple LDAP operation
is fast.

Assuming the server takes more than just 3 seconds to reply to
a single request for some reason, let's say 30 seconds.  The call will
result in a laming output of getent, of course, but it would have no
other consequences.  If the server needs actually more than two minutes
to reply, and doesn't return a ping either, the timeout is a very likely
indication that we have network problems, or the server is down.
In that case, the normal code path applies.  The connection with the
server will be closed and we try the next domain.

The idea I was proposing was just to drop all attempts to seconds guess
how fast a DC replies.  We're going to use LDAP with default settings
and that's it.  Default settings means, every operation times out after
the default timeout period of 120 seconds, which should really be
sufficient.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140618/7f2ff17a/attachment.sig>


More information about the Cygwin mailing list