>Number: 6439
>Category: system
>Synopsis: ypldap leaks its yp events
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Mon Aug 02 04:30:01 GMT 2010
>Closed-Date:
>Last-Modified:
>Originator:
>Release:
>Organization:
>Environment:
System : OpenBSD 4.7
Details : OpenBSD 4.7 (GENERIC.MP) #7: Fri Jun 4 20:35:06 EDT 2010
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Architecture: OpenBSD.amd64
Machine : amd64
>Description:
On a busy system, one will notice that the ypldap process' memory
usage grows fast. In my case, more than 40 megabytes per day.
It turns out that each time there is an YP event, the two functions
yp_disable_events() and yp_enable_events() are called to re-create
the events (from libevent) with the new YP descriptors. Although
yp_disable_events() is supposed to clear all previous events (and does),
yp_enable_events() never adds them to the env structure.
>How-To-Repeat:
Configure & run ypldap, ypbind, master.passwd.
$ while true; do getent passwd > /dev/null; done
Wait for a while then check memory usage of the ypldap
parent process.
>Fix:
The following prevents the leak for me:
Index: usr.sbin/ypldap/yp.c
===================================================================
RCS file: /cvs/src/usr.sbin/ypldap/yp.c,v
retrieving revision 1.4
diff -u -r1.4 yp.c
--- usr.sbin/ypldap/yp.c 10 Oct 2009 23:51:56 -0000 1.4
+++ usr.sbin/ypldap/yp.c 2 Aug 2010 03:44:27 -0000
@@ -91,6 +91,7 @@
fatal(NULL);
event_set(&ye->ye_event, i, EV_READ, yp_fd_event, NULL);
event_add(&ye->ye_event, NULL);
+ TAILQ_INSERT_TAIL(&env->sc_yp->yd_events, ye, ye_entry);
}
}
}
>Release-Note:
>Audit-Trail:
>Unformatted: