Continuously increasing memory usage since the update to 2.6
-
@kprovost I wasn't able to run the script for minutes, it crashed after ~20 sec with message "Killed". So attached the output for about 15 seconds: output.txt
The 128 zone increase during one day:
2022-05-22 08:48 :
128: 128, 0, 14566, 221, 812169, 0, 0
2022-05-22 17:19 :
128: 128, 0, 29424, 119, 1566853, 0, 0
-
@techniker_ctr
Okay, it's pretty safe to conclude we're indeed leaking from the 128 zone.The dtrace output doesn't immediately point to an obvious suspect, but having looked through it I think this is where the problem is:
kernel`malloc+0x72 kernel`nvpair_create_number+0x3f kernel`nvlist_add_number+0x26 kernel`pf_get_syncookies+0xa2 kernel`pfioctl+0x2bd6 kernel`devfs_ioctl+0xb0 kernel`VOP_IOCTL_APV+0x7b kernel`vn_ioctl+0x16c kernel`devfs_ioctl_f+0x1e kernel`kern_ioctl+0x2b7 kernel`sys_ioctl+0x101 kernel`amd64_syscall+0x387 kernel`0xffffffff8135af6e 4
There's nothing there to distinguish it from some of the other calls, but 2.6 does not have this commit: https://github.com/pfsense/FreeBSD-src/commit/410b11b25bdf39be3a73003ae5e5fadd9e3497fd
That fixes a memory leak in that code path, and pfsense ends up calling that regularly to obtain unrelated counters.I expect you to be able to confirm this by running
pfctl -si -v
in a loop. That should leak memory quickly.The good news is that the fix is already included in the upcoming 22.05 (plus) release and will also be in future CE releases.
-
Looks like it's already in 2.7 snapshots too if you're able to test one.
-
@kprovost said in Continuously increasing memory usage since the update to 2.6:
The good news is that the fix is already included in the upcoming 22.05 (plus) release and will also be in future CE releases.
Dumb Question: is there a command to release that memory on a running system? (I think no)
-
@fireodo There is not, no.
That's sort of why we call it 'leaked' memory. It's gone (at least until the system is rebooted). If this were a user space leak you could restart the application to reclaim the memory, but as it's leaking from the kernel you have to restart the kernel (i.e. reboot).
-
@kprovost said in Continuously increasing memory usage since the update to 2.6:
It's gone (at least until the system is rebooted).
Understood. Thank you!
BTW: I can also confirm this as I made myself researches in this matter on my Lab machine. (Following the instructions in this thread)Best regards,
fireodo -
-
-
@fireodo Good day, this problem was solved? I have the same problem and I have not managed to solve it. can help me please
-
@manueljv2 Yes, the fix is in both the current 2.7 snapshots and the upcoming 23.01 plus release.
-
@kprovost Has this issue been fixed? I am having the same issues and I am on 23.01.
Any ideas?
-
@dschmitz said in Continuously increasing memory usage since the update to 2.6:
@kprovost Has this issue been fixed? I am having the same issues and I am on 23.01.
See
https://forum.netgate.com/topic/178568/netgate-1100-high-memory-consumption/4 -
@steveits Thank you! Have installed the patch and configured the system tunable. Will post back if continue to have issues.
-
@dschmitz Steve's already pointed you at a way to have the UI show lower memory use, but I wanted to reinforce the point that what your 'top' screenshot shows is not a problem.
It does show that the majority of RAM is in use, but if you look one line lower you can see that 13 out of the 14 GB of wired memory is used by the ARC (ZFS's buffer cache).
That's a good thing. It means that the memory you paid for is doing stuff, rather than sitting around burning electrons for nothing. Once memory is needed for other things (such as pf states, or installing packages or any of the thousands of other things the system does) the ARC will release that memory.As a general rule, memory usage on modern operating systems is much more complicated than you think it is, even if you take this rule into account.
-