RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1832678 - mod_ldap: High CPU usage at apr_ldap_rebind_remove()
Summary: mod_ldap: High CPU usage at apr_ldap_rebind_remove()
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: httpd
Version: 7.7
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Luboš Uhliarik
QA Contact: RHEL Stacks Subsystem QE
URL:
Whiteboard:
Depends On:
Blocks: 1847585 2098056
TreeView+ depends on / blocked
 
Reported: 2020-05-07 04:12 UTC by asah
Modified: 2023-10-06 19:55 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1847585 (view as bug list)
Environment:
Last Closed: 2020-09-03 10:22:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Apache Bugzilla 64414 0 None None None 2020-05-07 04:12:52 UTC

Description asah 2020-05-07 04:12:52 UTC
Description of problem:

In uldap_connection_unbind, apr_ldap_rebind_remove() is always passed
NULL since ldc->ldap is either NULL on entry or is set to NULL.

This thread is expensive as apr_ldap_rebind_remove() acquires a mutex and iterates a linked list
trying to find a rebind reference matching NULL 

~~~
173:    while ((tmp_xref) && (tmp_xref->index != ld)) {
174:        prev = tmp_xref;
175:        tmp_xref = tmp_xref->next;
176:    }

173         while ((tmp_xref) && (tmp_xref->index != ld)) {
**(gdb) p ld
$1 = (LDAP *) 0x0**
(gdb) p tmp_xref
$2 = (apr_ldap_rebind_entry_t *) 0x7f256418eea0
(gdb) p tmp_xref->index
$3 = (LDAP *) 0x7f254c00b2c0
(gdb) p tmp_xref->next
$4 = (struct apr_ldap_rebind_entry *) 0x7f256418eea0
(gdb) n
175             tmp_xref = tmp_xref->next;
(gdb) n
173         while ((tmp_xref) && (tmp_xref->index != ld)) {
(gdb) p tmp_xref
$5 = (apr_ldap_rebind_entry_t *) 0x7f256418eea0
(gdb)
~~~


http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ldap/util_ldap.c
~~~

static apr_status_t uldap_connection_unbind(void *param)
{
    util_ldap_connection_t *ldc = param;

    if (ldc) {
        if (ldc->ldap) {          # if not NULL            
            if (ldc->r) { 
                ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, ldc->r, "LDC %pp unbind", ldc); 
            }
            ldap_unbind_s(ldc->ldap);
            **ldc->ldap = NULL**;     # Note the assignment
        }
        ldc->bound = 0;

        /* forget the rebind info for this conn */
        if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {   # if we get into this block,
            **apr_ldap_rebind_remove(ldc->ldap)**;  # <--- Passes NULL always
            apr_pool_clear(ldc->rebind_pool);
        }
    }

    return APR_SUCCESS;
}

~~~


LDAPReferrals Off is a workaround to avoid this loop.


Note You need to log in before you can comment on or make changes to this bug.