[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#4395) slapd in endless loop when opening to many connections

Full_Name: Ralf Haferkamp
Version: 2.3.19, HEAD
OS: Linux (Kernel 2.6)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

slapd is built to use epoll(). ulimit -n is 32 (Just for testing. The bug is
also there with larger values). I used a small test programm that just opens new
connection to the server. After it the server ran into the ulimit and I stopped
the test programm the slapd process is spinning in a endless loop an 99% cpu
While trying to track the problem down I found that is spinning in the main
daemon loop and epoll_wait() is signaling activity on a single descriptor. The
revents for this descriptor are set to "EPOLLERR | EPOLLHUP" and this case in
not handled in the loop. (It only handles EPOLLIN and EPOLLOUT)
Now I could use some help how to fix this condition and correctly close and
delete the connection that is causing this.

The test programm:
int main () {
    LDAP* ldap;
    int res;
    struct berval cred = { 0, ""};
    int proto = 3;
    int i; 
    ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &proto);
    for ( i=0; i < 1024; i++) {
        res = ldap_initialize(&ldap, "ldap://localhost";);
        res = ldap_sasl_bind_s(ldap, "", NULL, &cred, NULL, NULL, NULL);
        if (res != LDAP_SUCCESS ) {