From: Anil J. <an...@en...> - 2007-03-20 16:06:51
|
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 *** |
From: Alain S. <asp...@gm...> - 2007-03-20 17:28:39
|
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 <an...@en...> 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 > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev > -- -- Alain Spineux aspineux gmail com May the sources be with you |
From: <mi...@st...> - 2007-03-20 20:57:53
|
Alain Spineux wrote: > > I you want to survive to ldap restart, use the ReconnectLDAPObject that > do the job nicely. Note that there are various import fixes to ReconnectLDAPObject still waiting to be released. Ciao, Michael. |
From: Alain S. <asp...@gm...> - 2007-03-20 21:21:11
|
Are you advising us about the use of ReconnectLDAPObject in production environment ? Can you tell us more about that ? Thx On 3/20/07, Michael Str=F6der <mi...@st...> wrote: > > Alain Spineux wrote: > > > > I you want to survive to ldap restart, use the ReconnectLDAPObject that > > do the job nicely. > > Note that there are various import fixes to ReconnectLDAPObject still > waiting to be released. > > Ciao, Michael. > > ------------------------------------------------------------------------- > 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=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Python-LDAP-dev mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev > --=20 -- Alain Spineux aspineux gmail com May the sources be with you |
From: Anil J. <an...@en...> - 2007-03-20 21:13:56
|
Cool, that was the problem! Where is ReconnectLDAPObject documented? Don't think I've seen it before in the docs. On 3/20/07, Alain Spineux <asp...@gm...> wrote: > 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 <an...@en...> 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 > > Pyt...@li... > > > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev > > > > > > -- > -- > Alain Spineux > aspineux gmail com > May the sources be with you > |
From: <mi...@st...> - 2007-03-20 21:29:36
|
Anil Jangity wrote: > Where is ReconnectLDAPObject documented? In the source code. I've just implemented it for my own applications and considered it to be experimental. Ciao, Michael. |
From: <mi...@st...> - 2007-03-20 21:33:55
|
Alain Spineux wrote: > > Are you advising us about the use of ReconnectLDAPObject in production > environment ? Alain, you were the one who started the thread "ReconnectLDAPObject doesn't reconnect after main failure". ;-) As I said: There are issues with ReconnectLDAPObject up to latest released 2.2.1. SourceForge seems very slooooowwwww at the moment....so I'm too tired to provide URLs. > Can you tell us more about that ? The fix committed back then wasn't released yet. You might want to grab patches from CVS. Ciao, Michael. |
From: <mi...@st...> - 2007-03-20 21:40:33
|
Michael Ströder wrote: > > The fix committed back then wasn't released yet. You might want to grab > patches from CVS. http://python-ldap.cvs.sourceforge.net/python-ldap/python-ldap/Lib/ldap/ldapobject.py?r1=1.94&r2=1.95 >From glancing over the CVS comments it seems unlikely that you can simply grab whole ldapobject.py file from HEAD. Ciao, Michael. |
From: Alain S. <asp...@gm...> - 2007-03-20 22:26:29
|
I remember, of course ! And I was thinking it was stable after applying the patch. But leaved behind that you didn't released any new version since :-) On 3/20/07, Michael Str=F6der <mi...@st...> wrote: > > Alain Spineux wrote: > > > > Are you advising us about the use of ReconnectLDAPObject in production > > environment ? > > Alain, you were the one who started the thread > "ReconnectLDAPObject doesn't reconnect after main failure". ;-) > > As I said: There are issues with ReconnectLDAPObject up to latest > released 2.2.1. SourceForge seems very slooooowwwww at the moment....so > I'm too tired to provide URLs. > > > Can you tell us more about that ? > > The fix committed back then wasn't released yet. You might want to grab > patches from CVS. > > Ciao, Michael. > --=20 -- Alain Spineux aspineux gmail com May the sources be with you |