[Date Prev][Date Next]
ldap_simple_bind blocks while connecting; is not asynchronous (ITS#2720)
Full_Name: Henrik Storner
OS: Linux (Red Hat 9)
Submission from: (NULL) (126.96.36.199)
According to the manpage, "The ldap_simple_bind() call is asynchronous, taking
the same parameters but only initiating the bind operation and returning the
message id of the request it sent."
Combined with the timeout parameter in ldap_result(), I understood this to mean
that you can attempt to establish a connection to an ldap server with
ldap_simple_bind(), and have control of how long to wait for it the connection
establishment and bind operation to complete.
However, it seems that ldap_simple_bind() is not asynchronous while establishing
the TCP connection. If there is no response from the host that I try to connect
to, then the ldap_simple_bind() call hangs until the TCP connect times out. This
can easily take several minutes.
Is this intentional ? And if yes, is there a way to control the connect timeout
other than using alarm() to interrupt the operation ?
The URL link I provide is for a small test program showing this - it tries to
bind to an LDAP server on the IP specified as a commandline parameter. If you
use an IP with no host active, it will stall for a very long time in the
ldap_simple_bind() call. Sample output:
$ ./ldapbind 172.17.1.1
init for host 172.17.1.1:389
time=1063658155, bind completed with msgID=-1
I.e. ldap_simple_bind() took 189 seconds (over 3 minutes) to complete.