Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1877754

Summary: CLDAP ldap_result hangs if nobody listens on the port
Product: [Fedora] Fedora Reporter: Simon Pichugin <spichugi>
Component: openldapAssignee: Simon Pichugin <spichugi>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: ds-qe-bugs, mhonek, pbrezina, rmeggins, spichugi, vashirov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openldap-2.4.47-5.fc32 openldap-2.4.50-5.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1875361 Environment:
Last Closed: 2020-09-19 22:39:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1875361    
Bug Blocks:    

Description Simon Pichugin 2020-09-10 11:26:46 UTC
+++ This bug was initially created as a clone of Bug #1875361 +++

SSSD wants to perform multiple CLDAP pings to Active Directory in parallel. However openldap has a bug that cause a blocking i/o call when connection to the UDP port can not be established.

Upstream BZ (merged):
https://bugs.openldap.org/show_bug.cgi?id=9328

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

Reproducer:
$ gcc -ggdb3 -o client ./main.c -lldap
$ strace ./client
...
sendto(3, "0'\2\1\1\4\0c \4\0\n\1\0\n\1\0\2\1\0\2\1\0\1\1\0\207\vobje"..., 41, 0, {sa_family=AF_INET, sin_port=htons(3333), sin_addr=inet_addr("127.0.0.1")}, 16) = 41
poll([{fd=3, events=POLLIN|POLLPRI}], 1, 1000) = 1 ([{fd=3, revents=POLLERR}])
recvfrom(3, 0x493b10, 16256, 0, 0x493a90, [128]) = -1 ECONNREFUSED (Connection refused)
recvfrom(3, 

No LDAP server is running at localhost.

Comment 1 Fedora Admin user for bugzilla script actions 2020-09-11 14:53:44 UTC
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.

Comment 2 Fedora Update System 2020-09-15 13:07:58 UTC
FEDORA-2020-1686577da8 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-1686577da8

Comment 3 Fedora Update System 2020-09-15 13:08:03 UTC
FEDORA-2020-7b99075365 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-7b99075365

Comment 5 Fedora Update System 2020-09-15 14:55:17 UTC
FEDORA-2020-1686577da8 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-1686577da8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-1686577da8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2020-09-15 16:23:31 UTC
FEDORA-2020-7b99075365 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-7b99075365`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-7b99075365

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2020-09-19 22:39:05 UTC
FEDORA-2020-7b99075365 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2020-09-26 00:14:32 UTC
FEDORA-2020-1686577da8 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.