Blocking bind....

Michael Ströder michael at stroeder.com
Tue Mar 4 17:31:23 CET 2003


Jerry Lee wrote:
> 
> I recently posted to the list about a problem I am having with bind 
> blocking for a long time before it times out if the server isn't there.

You can elaborate on "the server isn't there"?


> Mario Cicognini (thx Mario!!) was kind enough to suggest the following:
> 
>         l = ldap.open(LDAPServer)
>         id = l.simple_bind(LDAPbindUsername, LDAPbindPassword)
>         status,res = l.result(id, 1, 60)
>         if status != 'RES_BIND':
>             return -1
> 
> which I tried with no success.

First note that the connection timeout part is done within OpenLDAP libs. It 
might be worth testing with newer OpenLDAP lib version 2.1.x. There's 
nothing more you can do at Python level.

> My app blocks at the
> id = l.simple_bind(LDAPbindUsername, LDAPbindPassword)
> line and doesn't return until around 90secs later.

Note that opening the connection is deferred until attempting first the LDAP 
operation. The ldap_initialize() function of OpenLDAP libs just returns a 
LDAP connection struct without actually connecting to the server. I guess 
your simple bind is the first LDAP operation.

Ciao, Michael.






More information about the python-ldap mailing list