another odd problem... with ldap restart

Alain Spineux aspineux at gmail.com
Tue Mar 20 18:28:34 CET 2007


You are working asynchronously !

add a ldap.result() into your try: except or use the synchronous
ldap.search_s()
method and you will get your error in the expected order.

I you want to survive to ldap restart, use the ReconnectLDAPObject that do
the job nicely.

BUT this let a good QUESTION :

If I start 10 asynchronous ldap requests when the server is down,
how many exception will I get ? 1 or 10 ? easy to test :-)


On 3/20/07, Anil Jangity <anilj at entic.net> wrote:
>
> If I restart the LDAP server, while connected to it using python-ldap,
> it doesn't seem to be throwing an exception at the right time.
>
> self.logger('*** about to do a search ***')
> result = g.ldap[customer][uid].search(base=suffix, scope="base",
> attr=["dn"])
> self.logger('*** finished search ***')
>
> g.ldap is a wrapper method that just does this:
> try:
> self.logger('1')
> ldap_result_id = self.l.search(ldap_url.dn, ldap_url.scope,
> ldap_url.filterstr, ldap_url.attrs)
> self.logger('2')
> except ldap.LDAPError, e:
> self.logger("LDAP SEARCH failed: %s" % (e))
> return False
>
> Once connected to the ldap server, I do stop-start ldap server. Then,
> I do two searches in order. The 2nd search throws an exception "Can't
> contact LDAP server". I am just wondering why it doesn't do it the
> first time?
>
> Mar 20 09:43:35 DEBUG 127.0.0.1 *** about to do a search ***
> Mar 20 09:43:35 INFO LDAP SEARCH: dn: uid=demo, ou=People, o=entic.net
> scope: 0 filter: (objectClass=top)
> Mar 20 09:43:35 INFO 1
> Mar 20 09:43:35 INFO 2
> Mar 20 09:43:36 DEBUG 127.0.0.1 *** about to do a search ***
> Mar 20 09:43:36 INFO LDAP SEARCH: dn: uid=demo, ou=People, o=entic.net
> scope: 0 filter: (objectClass=top)
> Mar 20 09:43:36 INFO 1
> Mar 20 09:43:36 INFO LDAP SEARCH failed: {'info': '', 'desc': "Can't
> contact LDAP server"}
> Mar 20 09:43:36 DEBUG 127.0.0.1 *** finished search ***
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Python-LDAP-dev mailing list
> Python-LDAP-dev at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/python-ldap-dev
>



-- 
--
Alain Spineux
aspineux gmail com
May the sources be with you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20070320/1397eac7/attachment.html>


More information about the python-ldap mailing list