Subject: lldpd: Memory usage of lldpd implies memory leak

From: [email-masked]
Date: Sat, 01 Jun 2019 12:53:08 +0200

Package: lldpd
Version: 0.9.6-1
Severity: normal

Dear Maintainer,

my system was slow due to increased memory usage.
htop shows lldpd consuming 425M Res Memory, rapidly increasing.

htop output:
 1264 _lldpd     20   0  471M  425M  1428 D  2.6 69.1     121h lldpd: connected to e-switch-1.

So I conclude lldpd consumed to much memory possibly due to a memory leak.

Regards,
M. Braun

-- System Information:
Debian Release: 9.9
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 4.9.0-9-686-pae (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to de_DE.utf8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to de_DE.utf8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages lldpd depends on:
ii  adduser              3.115
ii  init-system-helpers  1.48
ii  libbsd0              0.8.3-1
ii  libc6                2.24-11+deb9u4
ii  libevent-2.0-5       2.0.21-stable-3
ii  libjansson4          2.9-1
ii  libpci3              1:3.5.2-1
ii  libreadline7         7.0-3
ii  libsensors4          1:3.4.0-4
ii  libsnmp30            5.7.3+dfsg-1.7+deb9u1
ii  libssl1.0.2          1.0.2r-1~deb9u1
ii  libwrap0             7.6.q-26
ii  libxml2              2.9.4+dfsg1-2.2+deb9u2
ii  lsb-base             9.20161125

lldpd recommends no packages.

Versions of packages lldpd suggests:
pn  snmpd  <none>

-- no debconf information

---

From: michael-dev <[email-masked]>
Date: Sat, 01 Jun 2019 13:14:37 +0200

Hi,

while memory usage was increasing, syslog showed (few) lldpd[1264]: 
unable to receive netlink answer: No buffer space available messages.

Regards,
M. Braun

---

From: Vincent Bernat <[email-masked]>
Date: Sat, 01 Jun 2019 14:01:21 +0200

> unable to receive netlink answer: No buffer space available messages.

I think this may be more a consequence than a cause. The code around
this message seems to correctly handle memory, even in error cases.
Does the issue repeat after a restart?
-- 
An honest tale speeds best being plainly told.
		-- William Shakespeare, "Henry VI"

---

From: michael-dev <[email-masked]>
Date: Tue, 11 Jun 2019 11:36:26 +0200

Hi,

the problem occured on multiple machines. Directly after restart, lldpd 
memory usage seems fine, but eventually memory usage starts exploding 
again.
The started happening within weeks after upgrading to stretch. All 
machines were restartet after upgrading to stretch.

Regards,
M. Braun

---

From: Vincent Bernat <[email-masked]>
Date: Tue, 11 Jun 2019 12:45:17 +0200

❦ 11 juin 2019 11:36 +02, michael-dev <[email-masked]>:

> the problem occured on multiple machines. Directly after restart,
> lldpd memory usage seems fine, but eventually memory usage starts
> exploding again.

Is there anything special on your setup? Lots of interface running or
interfaces cycling (VM)?
-- 
My only love sprung from my only hate!
Too early seen unknown, and known too late!
		-- William Shakespeare, "Romeo and Juliet"

---

From: michael-dev <[email-masked]>
Date: Thu, 13 Jun 2019 09:03:42 +0200

> Is there anything special on your setup? Lots of interface running or

This has happened both in virtual and non-virtual machines, some of them 
only have one interface, others have two or three.
I also do not see spurious link up/down messages in dmesg, so interfaces 
should not have cycled.

Regards,
M. Braun

---

From: Vincent Bernat <[email-masked]>
Date: Thu, 13 Jun 2019 09:45:27 +0200

❦ 13 juin 2019 09:03 +02, michael-dev <[email-masked]>:

> This has happened both in virtual and non-virtual machines, some of
> them only have one interface, others have two or three.
> I also do not see spurious link up/down messages in dmesg, so
> interfaces should not have cycled.

Are there all 32bits x86 hosts?

If it happens in a few hours/days, could you run it through valgrind?
You will need to install lldpd-dbgsym (see
https://wiki.debian.org/AutomaticDebugPackages) and run the following
command:

  valgrind --leak-check=full lldpd -dd

It will use more memory than usual but when you see the memory growing a
lot, you can Ctrl-C and you'll get a report that would help to find
where the leak is.
-- 
Don't go around saying the world owes you a living.  The world owes you
nothing.  It was here first.
		-- Mark Twain

---

From: Gürkan Myczko <[email-masked]>
Date: Mon, 15 Jan 2024 10:56:28 +0100

Maybe the memory leak(s) are fixed with 1.0.18?
https://github.com/lldpd/lldpd/releases

---

From: Vincent Bernat <[email-masked]>
Date: Mon, 15 Jan 2024 11:34:33 +0100

This is only for FDP/EDP (rare protocols). But a similar problem was 
fixed in earlier releases. So, maybe.