[Bug 64414] New: mod_ldap: High CPU usage at apr_ldap_rebind_remove()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 64414] New: mod_ldap: High CPU usage at apr_ldap_rebind_remove()

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64414

            Bug ID: 64414
           Summary: mod_ldap: High CPU usage at  apr_ldap_rebind_remove()
           Product: Apache httpd-2
           Version: 2.4.43
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_ldap
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

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.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64414] mod_ldap: High CPU usage at apr_ldap_rebind_remove()

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64414

--- Comment #1 from Abhishek Sah <[hidden email]> ---
Discussion thread: https://markmail.org/message/tbpxtc4emjgao7jp

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64414] mod_ldap: High CPU usage at apr_ldap_rebind_remove()

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64414

--- Comment #2 from Joe Orton <[hidden email]> ---
WIP (and untested) patch https://github.com/apache/httpd/pull/124

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64414] mod_ldap: High CPU usage at apr_ldap_rebind_remove()

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64414

Joe Orton <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Joe Orton <[hidden email]> ---
Fixed in r1878890

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]