[python-ldap] ReconnectLDAPObject not working properly?

Michael Ströder michael at stroeder.com
Wed Jul 6 20:03:25 CEST 2011


Dusan Stefanik wrote:
> I tried simple test:
>>>> l = ldap.ldapobject.ReconnectLDAPObject('ldap://172.16.2.1:389/',trace_level=1,retry_max=3)
> *** ldap://172.16.2.1:389/ - ReconnectLDAPObject.set_option ((17, 3),{})
>>>> l.search_s("o=test",ldap.SCOPE_BASE,"objectclass=*")
> *** ldap://172.16.2.1:389/ - ReconnectLDAPObject.search_ext (('o=test', 0, 'objectclass=*', None, 0, None, None, -1, 0),{})
> *** ldap://172.16.2.1:389/ - ReconnectLDAPObject.unbind_ext ((None, None),{})
> *** Try 1. reconnect to ldap://172.16.2.1:389/...
> *** ldap://172.16.2.1:389/ - ReconnectLDAPObject.set_option ((17, 3),{})
> *** 1. reconnect to ldap://172.16.2.1:389/ successful, last operation will be repeated
> *** ldap://172.16.2.1:389/ - ReconnectLDAPObject.search_ext (('o=test', 0, 'objectclass=*', None, 0, None, None, -1, 0),{})
> Traceback (most recent call last):
> ...
> ldap.SERVER_DOWN: {'desc': "Can't contact LDAP server"}

What happened during "..."?

> So there is o retry_max = 3 but I don't see 3 attempts to connect from debug and as you can see: reconnect successful... but server is still down.
> It is like a problem in this call that will not raise exception:
> self._l = ldap.functions._ldap_function_call(ldap._ldap_module_lock,_ldap.initialize,uri)

What makes you think _ldap.initialize() will not raise an exception?

It's hard to tell what's happening without looking at the calling code.

Ciao, Michael.


More information about the python-ldap mailing list