https://bugs.openldap.org/show_bug.cgi?id=9328
--- Comment #1 from Howard Chu hyc@openldap.org --- (In reply to pbrezina from comment #0)
When using LDAP over UDP, calling ldap_result() hangs if there is nobody listening on the remote port.
The problem is that it calls recvfrom() twice, the first attempt returns ECONNREFUSED but this is ignored. The seconds read then blocks/timeouts/returns EAGAIN depending on the sockets settings, however we know that we will never receive any data so it should return an error. See [1]
poll([{fd=20, events=POLLIN|POLLPRI}], 1, 0) = 1 ([{fd=20, revents=POLLERR}]) recvfrom(20, 0x18dade0, 16256, 0, 0x18dad60, [128]) = -1 ECONNREFUSED (Connection refused) recvfrom(20, <unfinished ...>) = ?
[1] https://git.openldap.org/pbrezina/openldap/-/blob/master/libraries/libldap/ result.c#L489
Need more details on how to reproduce this. On my own run, the poll() hangs since it's called with an infinite timeout. (result.c:1135, ldap_int_select()).