Memory leak in dhcpd?

Hiroyasu Tsunekawa tunekawa at designet.co.jp
Thu Aug 8 07:17:41 UTC 2013


Hello,

We are currently running a DHCP server on a Debian GNU/Linux 5.0 machine.
The server is running to lease IPv4 and IPV6 addresses.
We are running dhcp-4.2.4-P2, and after running our server for a short period of time,
we noticed that the dhcpd process for IPV6 was steadily increasing its memory usage.
We are believe that this is due to a memory leak.

After running a ps command and evaluating a number of VSZ values, we confirmed that memory usage is increasing.

<ps query VSZ Values>
pslist.20130626000001:116996
pslist.20130627000001:126272
pslist.20130628000001:126692
pslist.20130629000001:126864
pslist.20130630000001:142256
pslist.20130701000001:160544
pslist.20130702000001:175432
pslist.20130703000001:190232
pslist.20130704000001:206920
pslist.20130705000001:223644
pslist.20130706000001:239592
pslist.20130707000001:257020
pslist.20130708000002:276208
pslist.20130709000001:291208
pslist.20130710000001:297540
pslist.20130711000001:297700
pslist.20130712000001:297896
pslist.20130713000001:298104
pslist.20130714000001:298324
pslist.20130715000001:298580
pslist.20130716000001:298828
pslist.20130717000001:299048
pslist.20130718000001:299272
pslist.20130719000001:299500
pslist.20130720000001:307640
pslist.20130721000001:317904
pslist.20130722000001:328844
pslist.20130723000001:339244
pslist.20130724000001:348836
pslist.20130725000001:358288
pslist.20130726000001:360416

Our first suspicion was that memory size was increaseing in relation to the number of IP addresses leased;
however, after some research we found out that the number of leased address only totaled a count of 87.
This is a small number considering ISP's lease IP addresses in the thousands.

We used the following options to compile our dchpd binary:
--prefix=/usr
--with-srv-lease-file=/var/state/dhcp/dhcpd.leases
--with-srv6-lease-file=/var/state/dhcp/dhcpd6.leases
--with-cli-lease-file=/var/state/dhcp/dhclient.leases
--with-cli6-lease-file=/var/state/dhcp/dhclient6.leases

We had to change the hash size of the lease table from 100003 to 200009 to compensate
for the fact that an increase of IPv4 addresses increases the startup time of the process.
The value LEASE_HASH_SIZE was changed in the src/includes/dhcpd.h file.

Could this change be a possible cause for the memory leak?

We are in need of a solution as quickly as possible as we have ISP's
that are using this setup to lease addresses to their customers.

If you know of any methods to find a solution, similar examples to our situation or any feedback
that would help us would be greatly appreciated.

-- 
Hiroyasu Tsunekawa

DesigNET, INC.


More information about the dhcp-users mailing list