https://bugs.openldap.org/show_bug.cgi?id=10141

--- Comment #6 from Vivek Anand <[email protected]> ---
Created attachment 1002
  --> https://bugs.openldap.org/attachment.cgi?id=1002&action=edit
set async mode

Basically I'm running a script which is hitting GET api continuously which is
authenticating via ldap.
The flow is like (MyApp --> Linux-PAM --> nss_ldap --> openldap)

Sometimes if ldap server is not reachable, the script hangs as it get stuck in
while loop which is continuously hitting "ldap_int_tls_connect"
("ldap_int_tls_start" function of "openldap-2.6.3/libraries/libldap/tls2.c").
During this time MyApp consumes 100% CPU and remains there about 16~17min.
After that connection gets terminated and CPU comes back to normal.

In order to fix this problem, I tried below 2 approaches:
1) introduced a sleep of 50ms to reduce while loop frequency (sync mode of
operation): this reduced CPU consumption but process remain stuck for 16~17 min
and got released after that
2) set async mode of operation (using LDAP_BOOL_SET in
openldap-2.6.3/libraries/libldap/init.c) : Got similiar result as approach 1

Both of above 2 approach reduced CPU consumption of MyApp from ~25%(ideal
scenario) to ~1.3% and with that I'm not able to hit 100% cpu with api load.

I have query as below:
1) How to cater this issue for sync mode of operation. Is there any timeout
parameter which we can configure if it's unable to connect ldap server, then it
should come out of while loop after configured timeout ?
2) Is there any way to set async mode via any configuration?

-- 
You are receiving this mail because:
You are on the CC list for the issue.

Reply via email to