This problem has happened when LDAP connection pooling is on (use_pool=True), page_size > 0 and pool_connection_timeout is < 'ldap server response time'. The scenario is as follows:
- An user tries to log in to a domain that is attached to LDAP backend.
- LDAP server does not respond in `pool_connection_timeout` seconds, causing LDAP connection to raise a ldap.TIMEOUT() exception
- From now on, all subsequent LDAP requests will fail with ldappool.MaxConnectionReachedError
An in-depth analysis explains why it happens:
- LDAP query initiated for user login request with BaseLdap._ldap_get() function call, which grabs a connection with self.get_connection() and invokes conn.search_s()
- conn.search_s() invokes conn._paged_search_s() since page_size is > 0
- conn._paged_search_s() calls conn.search_ext() (PooledLDAPHandler.search_ext) method
- conn.search_ext() initiates an asynchronous LDAP request and returns an AsynchronousMessage object to the _paged_search_s(), representing the request.
- conn._paged_search_s() tries to obtain asynchronous LDAP request results via calling conn.result3() (PooledLDAPHandler.result3)
- conn.result3() calls message.connection.result3()
- the server cannot respond in pool_connection_timeout seconds,
- message.connection.result3() raises a ldap.TIMEOUT(), causes subsequent connection release function, message.clean() to be not called
- the connection is kept active forever, subsequent requests cannot use it anymore
Reproducer:
- Deploy an LDAP server of your choice
- Fill it with many data so the search takes more than `pool_connection_timeout` seconds
- Define a keystone domain with the LDAP driver with following options:
- Point the domain to the LDAP server
- Try to login to the OpenStack dashboard, or try to do anything that uses the LDAP user
- Observe the /var/log/apache2/keystone_error.log, it should contain ldap.TIMEOUT() stack traces followed by `ldappool.MaxConnectionReachedError` stack traces
Known workarounds:
- Disable LDAP pooling by setting use_pool=Flase
- Set page_size to 0
This is a follow-up issue for LP#1896125.
This problem has happened when LDAP connection pooling is on (use_pool=True), page_size > 0 and pool_connection _timeout is < 'ldap server response time'. The scenario is as follows:
- An user tries to log in to a domain that is attached to LDAP backend. n_timeout` seconds, causing LDAP connection to raise a ldap.TIMEOUT() exception MaxConnectionRe achedError
- LDAP server does not respond in `pool_connectio
- From now on, all subsequent LDAP requests will fail with ldappool.
An in-depth analysis explains why it happens:
- LDAP query initiated for user login request with BaseLdap. _ldap_get( ) function call, which grabs a connection with self.get_ connection( ) and invokes conn.search_s() search_ s() since page_size is > 0 search_ s() calls conn.search_ext() (PooledLDAPHand ler.search_ ext) method search_ s() tries to obtain asynchronous LDAP request results via calling conn.result3() (PooledLDAPHand ler.result3) connection. result3( ) _timeout seconds, connection. result3( ) raises a ldap.TIMEOUT(), causes subsequent connection release function, message.clean() to be not called
- conn.search_s() invokes conn._paged_
- conn._paged_
- conn.search_ext() initiates an asynchronous LDAP request and returns an AsynchronousMessage object to the _paged_search_s(), representing the request.
- conn._paged_
- conn.result3() calls message.
- the server cannot respond in pool_connection
- message.
- the connection is kept active forever, subsequent requests cannot use it anymore
Reproducer:
- Deploy an LDAP server of your choice n_timeout` seconds
- Fill it with many data so the search takes more than `pool_connectio
- Define a keystone domain with the LDAP driver with following options:
[ldap] _timeout = 3
use_pool = True
page_size = 100
pool_connection
pool_retry_max = 3
pool_size = 10
- Point the domain to the LDAP server apache2/ keystone_ error.log, it should contain ldap.TIMEOUT() stack traces followed by `ldappool. MaxConnectionRe achedError` stack traces
- Try to login to the OpenStack dashboard, or try to do anything that uses the LDAP user
- Observe the /var/log/
Known workarounds:
- Disable LDAP pooling by setting use_pool=Flase
- Set page_size to 0