Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2019 21:13:27 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 242746] Deleting (or re-setting) an IP address with ifconfig holds (leaks?) memory
Message-ID:  <bug-242746-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D242746

            Bug ID: 242746
           Summary: Deleting (or re-setting) an IP address with ifconfig
                    holds (leaks?) memory
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: ghuckriede@blackberry.com

Overview:
Setting an IP address consumes 'ifaddr' typed memory.  When destroying the =
IP
address the memory is not freed.

This memory does not appear to be collected later, as running the below scr=
ipt
shows no recovery after continuously re-setting the ip address for 16 hours.

The leaked memory was tracked down to the ifa_alloc() function, see line 84=
5 of
https://svnweb.freebsd.org/base/head/sys/net/if.c?revision=3D355070&view=3D=
markup
Instrumenting the code revealed that there are more ifa_ref() calls than
ifa_free() calls.  This results in the memory being held, as the system
believes there is still a reference to this memory.


Steps to Reproduce:
'ifconfig <interface> inet' an address and then 'ifconfig <interface> inet
delete' it.


Actual Results:
# vmstat -m | grep ifaddr
       ifaddr   141    36K       -      235  16,32,64,128,256,512,2048,4096
#=20
# ifconfig em1 inet  192.168.200.44
# vmstat -m | grep ifaddr
       ifaddr   142    36K       -      236  16,32,64,128,256,512,2048,4096
# ifconfig em1 inet delete 192.168.200.44
# vmstat -m | grep ifaddr
       ifaddr   142    36K       -      236  16,32,64,128,256,512,2048,4096

# cat /tmp/loop
while true
do
        ifconfig em1 192.168.200.33=20
        sleep 1=20
        vmstat -m | grep ifaddr
done
# /tmp/loop
       ifaddr   135    37K       -      294  16,32,64,128,256,512,2048,4096
       ifaddr   136    38K       -      295  16,32,64,128,256,512,2048,4096
       ifaddr   137    38K       -      296  16,32,64,128,256,512,2048,4096
       ifaddr   138    39K       -      297  16,32,64,128,256,512,2048,4096
....snip (16 hours worth of logs)...
       ifaddr 1834875 917406K       -  1835088  16,32,64,128,256,512,2048,4=
096
       ifaddr 1834876 917407K       -  1835089  16,32,64,128,256,512,2048,4=
096
       ifaddr 1834877 917407K       -  1835090  16,32,64,128,256,512,2048,4=
096
       ifaddr 1834878 917408K       -  1835091  16,32,64,128,256,512,2048,4=
096
       ifaddr 1834879 917408K       -  1835092  16,32,64,128,256,512,2048,4=
096
^C
#


Expected Results:
Not to leak/hold onto memory.


Build Date & Hardware:
HEADr355854 on amd64 target with any networking interface

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-242746-227>