[python-ldap] Multiple timeout values in python-ldap, which ones are applicable

William Brown william at blackhats.net.au
Mon Apr 5 21:18:22 EDT 2021


> On 18 Mar 2021, at 18:26, varun mittal <vmittal05 at gmail.com> wrote:
> 
> I am using python-ldap==3.1.0 with python3 to query my AD server.
> 
> With the following timeout values:
> 
> ldap.set_option(ldap.OPT_NETWORK_TIMEOUT, 30)
> ldap.set_option(ldap.OPT_TIMEOUT, 120)
> conn = ldap.initialize(ldap://server-ip)
> 
> Using 3 types of queries - synchronous search_s(), asynchronous with and without paging search_ext()
> 
> I am not using any timeout in the _ext method.
> 
> One of my LDAP searches(asynchronous with paging) took about 14 minutes to complete, in the customer environment. Eventually, the search was successful.

I think you may want OPT_TIMELIMIT to limit the search time, rather than OPT_TIMEOUT. 

As well, because you are doing this as async with paging, there may be other timing interactions here that could be subtle and interacting. 

Hope that helps a bit

> 
> Looking at the documentation, I am not sure which timeout value would be applicable here.
> 
> I thought setting OPT_TIMEOUT should suffice for all kinds of searches.
> 
> What am I missing here?
> _______________________________________________
> python-ldap mailing list
> python-ldap at python.org
> https://mail.python.org/mailman/listinfo/python-ldap

--
Sincerely,

William



More information about the python-ldap mailing list