Issue 8545 - Undesired timeout when polling for results
Summary: Undesired timeout when polling for results
Status: VERIFIED INVALID
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.44
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Howard Chu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-14 10:35 UTC by shalopo@gmail.com
Modified: 2021-03-21 19:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description shalopo@gmail.com 2016-12-14 10:35:34 UTC
Full_Name: Shahar Lupu
Version: 2.4.44
OS: Ubuntu
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (81.218.29.26)


When calling ldap_result with a timeout={0,0} (polling), it returns LDAP_TIMEOUT
even though there are available messages in the socket.
This occurs when calling ldap_results with all=true and a multi-message response
has arrived. In this case, if the client has already received on the socket
every message for the response, it is desirable that all the messages are
collected within this ldap_result call. Instead of only polling for the
specified timeout, ldap_result applies the timeout (zero when polling) on the
wait4msg loop. Consequently, ldap_result returns LDAP_TIMEOUT after the first
message if the response is composed of more than one message.
While it may be a good idea to apply a timeout for the wai4msg loop (rather than
only the polling on the socket), it is undesirable in some cases and should at
least be configurable. Or perhaps timeout=polling should never be applied on the
wait4msg loop.
Comment 1 Quanah Gibson-Mount 2017-03-17 16:49:59 UTC
moved from Incoming to Software Bugs
Comment 2 Howard Chu 2021-03-21 16:08:27 UTC
(In reply to shalopo@gmail.com from comment #0)
> Full_Name: Shahar Lupu
> Version: 2.4.44
> OS: Ubuntu
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (81.218.29.26)
> 
> 
> When calling ldap_result with a timeout={0,0} (polling), it returns
> LDAP_TIMEOUT
> even though there are available messages in the socket.
> This occurs when calling ldap_results with all=true and a multi-message
> response
> has arrived. In this case, if the client has already received on the socket
> every message for the response, it is desirable that all the messages are
> collected within this ldap_result call. Instead of only polling for the
> specified timeout, ldap_result applies the timeout (zero when polling) on the
> wait4msg loop. Consequently, ldap_result returns LDAP_TIMEOUT after the first
> message if the response is composed of more than one message.
> While it may be a good idea to apply a timeout for the wai4msg loop (rather
> than
> only the polling on the socket), it is undesirable in some cases and should
> at
> least be configurable. Or perhaps timeout=polling should never be applied on
> the
> wait4msg loop.

None of this will make any difference. In try_read1msg, there is a check
to see if the socket is still readable at the end, in which case it will
loop back and read the next message. As such, when it returns to wait4msg,
all readable messages have already been processed. So even if it returns LDAP_TIMEOUT, it returns all available messages. If it only returns one message, that means no others were available.