Univention Bugzilla – Full Text Bug Listing |
Summary: | uldap.py Wrong reconnect count | ||
---|---|---|---|
Product: | UCS | Reporter: | Philipp Hahn <hahn> |
Component: | univention-lib | Assignee: | Philipp Hahn <hahn> |
Status: | CLOSED FIXED | QA Contact: | Felix Botner <botner> |
Severity: | normal | ||
Priority: | P5 | CC: | best, gohmann, kramer |
Version: | UCS 4.0 | Keywords: | interim-2 |
Target Milestone: | UCS 4.0 | Flags: | hahn:
Patch_Available+
|
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://forge.univention.org/bugzilla/show_bug.cgi?id=42868 | ||
What kind of report is it?: | --- | What type of bug is this?: | --- |
Who will be affected by this bug?: | --- | How will those affected feel about the bug?: | --- |
User Pain: | Enterprise Customer affected?: | ||
School Customer affected?: | ISV affected?: | ||
Waiting Support: | Flags outvoted (downgraded) after PO Review: | ||
Ticket number: | Bug group (optional): | ||
Max CVSS v3 score: | |||
Bug Depends on: | 34292, 35841 | ||
Bug Blocks: | 35741 |
Description
Philipp Hahn
2014-09-09 20:14:16 CEST
From 9c8f5aeec8092562f3d241555f5844d79400a54c Mon Sep 17 00:00:00 2001 Message-Id: <9c8f5aeec8092562f3d241555f5844d79400a54c.1410286807.git.hahn@univention.de> From: Philipp Hahn <hahn@univention.de> Date: Tue, 9 Sep 2014 20:16:32 +0200 Subject: [PATCH] Bug #35852 uldap: Fix LDAP reconnect count Organization: Univention GmbH, Bremen, Germany python-2.4.15 also re-connects internally for the start_tls_s() call, which leads to the re-connect being done n^2 times now. Remove the hand-rolled loop in favour of the python-ldap internal handling, as calling ReconnectLDAPObject(retry_max=1) would disable the re-tries for all other operations. Also fix a string splitting error: "string" is deprecated and no longer imported. --- .../ucs-4.0-0/base/univention-python/debian/changelog | 6 ++++++ .../ucs-4.0-0/base/univention-python/debian/control | 2 +- .../ucs-4.0-0/base/univention-python/modules/uldap.py | 17 ++--------------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/changelog b/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/changelog index f9ae24f..b730b8b 100644 --- a/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/changelog +++ b/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/changelog @@ -1,3 +1,9 @@ +univention-python (8.0.1-1) unstable; urgency=low + + * Bug #35852: Fix LDAP reconnect count + + -- Philipp Hahn <hahn@univention.de> Tue, 09 Sep 2014 20:13:58 +0200 + univention-python (8.0.0-3) unstable; urgency=low * Call explicit python_support (Bug #35138) diff --git a/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/control b/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/control index 9baee07..ddcbdfd 100644 --- a/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/control +++ b/branches/ucs-4.0/ucs-4.0-0/base/univention-python/debian/control @@ -10,7 +10,7 @@ XS-Python-Version: 2.6,2.7 Package: python-univention Architecture: all Depends: ${misc:Depends}, ${python:Depends}, - python-ldap, + python-ldap (>= 2.4.15), python-dns, python-univention-debug, python-cracklib diff --git a/branches/ucs-4.0/ucs-4.0-0/base/univention-python/modules/uldap.py b/branches/ucs-4.0/ucs-4.0-0/base/univention-python/modules/uldap.py index 8933177..a1c52c9 100644 --- a/branches/ucs-4.0/ucs-4.0-0/base/univention-python/modules/uldap.py +++ b/branches/ucs-4.0/ucs-4.0-0/base/univention-python/modules/uldap.py @@ -31,9 +31,6 @@ # <http://www.gnu.org/licenses/>. import ldap -import types -import time -import sys import ldap.schema import univention.debug from univention.config_registry import ConfigRegistry @@ -84,7 +81,7 @@ def getBackupConnection(start_tls=2, decode_ignorelist=[]): lo=access(host=ucr['ldap/master'], port=port, base=ucr['ldap/base'], binddn='cn=backup,'+ucr['ldap/base'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist) except ldap.SERVER_DOWN, e: if ucr['ldap/backup']: - backup=string.split(ucr['ldap/backup'],' ')[0] + backup=ucr['ldap/backup'].split(' ')[0] lo=access(host=backup, port=port, base=ucr['ldap/base'], binddn='cn=backup,'+ucr['ldap/base'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist) else: raise ldap.SERVER_DOWN, e @@ -176,17 +173,7 @@ class access: self.client_connection_attempt = client_retry_count+1 - i=0 - while i <= self.client_connection_attempt: - try: - self.__open(ca_certfile) - break - except ldap.SERVER_DOWN: - if i >= (self.client_connection_attempt-1): - raise - univention.debug.debug(univention.debug.LDAP, univention.debug.INFO, "Can't contact LDAP server. Try again (%d/%d)" % (i+1,self.client_connection_attempt)) - time.sleep(1) - i+=1 + self.__open(ca_certfile) def __encode_pwd(self, pwd): if isinstance( pwd, unicode ): -- 1.9.1 r53508 | Bug #35852 uldap: Fix LDAP reconnect count patch committed Package: univention-python Version: 8.0.1-1.143.201409100916 Branch: ucs_4.0-0 r53513 | Bug #35741 uldap: retry changelog + The new version of the package <package>python-ldap</package> caused the <classname>univention.uld ap</classname> implementation to retry failed connects too many times. + This has been fixed (<ulink url="&ucsbug;35841">Bug 35841</ulink>, <ulink url="&ucsbug;35741">Bug 35741</ulink>). <http://jenkins.knut.univention.de:8080/job/UCS-4.0/job/UCS-4.0-0/job/Release%20Notes/18/artifact/webroot/release-notes-4.0-0-en.html#changelog:lib> FAIL - Changelog? OK - /etc/init.d/slapd stop python import univention.uldap univention.uldap.getAdminConnection() Trying 1. (of 11) reconnect to ldap://master.new.intranet:7389... ... Trying 11. (of 11) reconnect to ldap://master.new.intranet:7389... => LDAPError - SERVER_DOWN: {'desc': "Can't contact LDAP server"} (In reply to Felix Botner from comment #3) > FAIL - Changelog? r54160 | Bug #35852 uldap: Fix bug number 35741 (ucs-test) → 35852 (univention-python) OK UCS 4.0-0 has been released: http://docs.univention.de/release-notes-4.0-0-en.html http://docs.univention.de/release-notes-4.0-0-de.html If this error occurs again, please use "Clone This Bug". |