Posting on behalf of Sushmita Roy, This seems like
a bug in the SDK ...
--------------------------------------------------
Hi,
I am using Netscape LDAP sdk version 5 on linux for an ldap
client which makes use of the LDAP async API for binding and
searching.
I am setting the LDAP_OPT_ASYNC_CONNECT option
to handle all operation in a completely "async" manner.
I noticed that when async search requests are fired at a
very high rate, some results of successful searches never
come. After tracing the code flow I discovered the following:
- while sending a request to the server, (in request.c, lines 275-280 )
if nsldapi_ber_flush(), returns -2 and the
LDAP_BITOPT_ASYNC is set the socket is added to the
poll list for POLLOUT and a success is sent.
- while resending the request, (in result.c, 390-403), only if
the ldap connection is in LDAP_CONNST_CONECTING
state is the request refired. The status of the ldap connection
is set to LDAP_CONNST_CONNECTED once a bind is
successful and remains even if an EAGAIN error is returned
while sending a search request. Thus the search is never refired.
I was thinking of modifying the current handling of the EAGAIN
error for a search request, in one of the following ways:
- an LDAP_SERVER_DOWN error could be returned
so that the client does not keep waiting for results,
- an addiotional check can be added to result.c such that
if the value of lr_status is LDAP_REQST_WRITING,
it should be refired. I think LDAP_REQST_WRITING,
is not being used anywhere else.
Please let me know if any other handling for the above case
already exists, or I can go ahead with one of the above modifications.
Thanks and regards,
Sushmita