Hi all,
I have one process that needs to communicate with two different LDAP servers. For this reason, the process creates two threads (each thread manages the connection with one server).
For tests, the process launch several "search" requests for the two threads at a fixed rate (about 100 searches/s). Each thread polls the server responses using the API "ldap_result" in asynchronous mod using LDAP_RES_ANY and LDAP_MSG_ONE macros.
In this scenario, the "ldap_result" system call of one thread return with error (-1) and the error is "Can't contact the LDAP server".
I tried to launch one single thread and it works fine (the maximum measured rate is 800 searches/s). Also I launch the two threads alternating the search requestes (so that only one of them is running) and it works fine.
It seems that the error happens only if the two process runs simultaneously. Thinking of a race condition error, I lead the same tests using the libldap_r library to build the process but the error still remains.
Have anyone encountered a similar error?
The used openldap version is 2.3.27 both for LDAP servers ("slapd") and the libraries.
Thanks in advance for the reply.
Fabio Ubaldi wrote:
I have one process that needs to communicate with two different LDAP servers. For this reason, the process creates two threads (each thread manages the connection with one server).
Did you link to libldap_r instead of libldap? Search the mailing list archives for more information.
Ciao, Michael.
Hi, I used the libldap_r library as a try when I see that with libldap library I faced the abovementioned error.
Searching in the list archive, I understand that this try is useless, because libldap_r is needed if a single connection is shared between more threads. In my scenario it doesn't happen; indeed each thread opens a connection with a different "slapd" server (i.e. each thread calls the "LDAP_init" function, performs the bind and so on) and only it performs the search request with this server. Giving more details, I lead the tests implementing a process that (using the timer interrupt) is waken at constant interval time and send requests to these threads (using UNIX sockets). The threads manage the requests performing the "ldap_search" and the "ldap_result"
Thanks in advance.
Michael Ströder wrote:
Fabio Ubaldi wrote:
I have one process that needs to communicate with two different LDAP servers. For this reason, the process creates two threads (each thread manages the connection with one server).
Did you link to libldap_r instead of libldap? Search the mailing list archives for more information.
Ciao, Michael.
openldap-software@openldap.org