python-ldap search_s hanging problem on Linux box

Michael Ströder michael at
Wed Jun 24 12:16:56 CEST 2009

Todd Hanson wrote:
> I have a query that was written in python (2.5) utilizing the
> python-ldap package (newest stable version for both Windows and Linux)
> to query an Active Directory server for a user’s group membership.  The
> code works fine on my test machine (2-3 seconds for result) which is
> Windows based but when I move the code over and run it on our production
> Linux (Ubuntu 8.10) server the query hangs for exactly 5 minutes and
> then displays the results.  Does anyone have any ideas where this delay
> might be coming from and how I can resolve the issue?

I've also observed strange things like this with MS AD before. I don't
know a clear solution. It kind of sounds like a timeout.

One very important thing is to double-check the DNS A and PTR RRs for
all systems involved and avoid using DNS aliases (CNAME). This is
especially true e.g. for SASL bind requests where I experienced strange
problems when using IP address instead of FQDN when binding to AD.

Ciao, Michael.

More information about the python-ldap mailing list