Bug 274129 - net/mpd5 14.0-STABLE mpd5 memory leak
Summary: net/mpd5 14.0-STABLE mpd5 memory leak
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Eugene Grosbein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-27 13:26 UTC by Anatoliy Nebrat
Modified: 2023-10-09 11:02 UTC (History)
3 users (show)

See Also:
eugen: maintainer-feedback+


Attachments
top (25.81 KB, image/png)
2023-09-27 13:26 UTC, Anatoliy Nebrat
no flags Details
top (27.84 KB, image/png)
2023-09-27 16:14 UTC, Anatoliy Nebrat
no flags Details
top (24.36 KB, image/png)
2023-09-27 18:43 UTC, Anatoliy Nebrat
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anatoliy Nebrat 2023-09-27 13:26:22 UTC
Created attachment 245286 [details]
top

FreeBSD 13.2-STABLE
FreeBSD 14.0-STABLE #10 stable/14-n265251-e30f7d9b9bb4

mpd5 5.9_16 there is a memory leak. Reaches 20G in less than a day.
Comment 1 Anatoliy Nebrat 2023-09-27 16:14:19 UTC
Created attachment 245293 [details]
top

Uptime 03:33
Comment 2 Anatoliy Nebrat 2023-09-27 18:43:30 UTC
Created attachment 245295 [details]
top

uptime 6 hours
Comment 3 Eugene Grosbein freebsd_committer freebsd_triage 2023-09-27 21:56:32 UTC
This is very strange as code of mpd5 is basically same for all branches of FreeBSD.

Maybe there is some leak in FreeBSD libraries used by mpd5 like libradius. Do you use mpd5 with RADIUS? Did you use mpd5 previously with same configuration but with earlier FreeBSD branch?
Comment 4 Eugene Grosbein freebsd_committer freebsd_triage 2023-09-27 22:23:54 UTC
Also, do you use mpd5 package from official FreeBSD package repository? Or do you build it yourself? Of perhaps you use mpd5 built by some 3rd party project like pfSense or other?
Comment 5 Anatoliy Nebrat 2023-09-28 07:31:55 UTC
Clarification

mpd5 from ports in this configuration works from version 12.2-RELEASE.
RADIUS is used.

The problem appeared after updating to 13.2-STABLE.

After updating the kernel to 14.0-stable, the problem remained. 
After updating the world to 14.0-stable the problem disappeared.

So the problem is relevant only for 13.2-STABLE after 13.2-STABLE #4 stable/13-n254690-eba26d0ba37e
Comment 6 Eugene Grosbein freebsd_committer freebsd_triage 2023-09-28 09:25:45 UTC
So, this is either problem with libradius or libpcap in stable/13.

libpcap may be used to compile pcap-based filters for ng_bpf/ng_car as documented in the last section here:
https://mpd.sourceforge.net/doc5/mpd30.html#radius

Do you use "mpd-filter" RADIUS attributes for mpd5?
Comment 7 Anatoliy Nebrat 2023-09-28 16:50:35 UTC
(In reply to Eugene Grosbein from comment #6)
yes, I use "mpd-filter"
Comment 8 Ed Maste freebsd_committer freebsd_triage 2023-09-28 17:49:36 UTC
(In reply to Anatoliy Nebrat from comment #5)
To confirm, the issue does not occur with 12.2 or 14.0, but does with 13.2?

From 12.2 to 13.2 libpcap was updated from 1.9.0 to 1.9.1.
From 13.2 to 14.0 it was updated to 1.10.4.

(I haven't checked for changes in libradius yet.)
Comment 9 Eugene Grosbein freebsd_committer freebsd_triage 2023-09-28 21:39:46 UTC
(In reply to Anatoliy Nebrat from comment #7)

Can you give an example for one of mpd-filters applied to your users? I'd try to reproduce the problem with small code sample but I need such "real life" example.
Comment 10 Eugene Grosbein freebsd_committer freebsd_triage 2023-09-29 06:39:35 UTC
(In reply to Anatoliy Nebrat from comment #5)

Your 13.2-STABLE is 7 months old:
https://cgit.freebsd.org/src/commit/?id=eba26d0ba37e

Could you please try updating to recent stable/13 to make sure the problem still persist?
Comment 11 Anatoliy Nebrat 2023-09-29 07:19:37 UTC
(In reply to Eugene Grosbein from comment #9)
Framed-Pool:=ppp_free
mpd-limit+=out#1#Other=all  rate-limit 51200000 9600000 19200000
mpd-limit+=in#1#Other=all  rate-limit 51200000 9600000 19200000
Comment 12 Anatoliy Nebrat 2023-09-29 07:29:40 UTC
(In reply to Eugene Grosbein from comment #10)
The last update to 13.2-stable was 26.09.2023 
The last update to 14.0-stable was 27.09.2023 

There is no way to branch to 13.2
Comment 13 Eugene Grosbein freebsd_committer freebsd_triage 2023-09-30 12:49:45 UTC
(In reply to Anatoliy Nebrat from comment #11)

I need an example of "mpd-filter", not "mpd-limit". Could you please attach mpd.conf, please?
Comment 14 Anatoliy Nebrat 2023-09-30 17:21:40 UTC
(In reply to Eugene Grosbein from comment #13)
Sorry, I don't use the mpd-filter
Comment 15 Eugene Grosbein freebsd_committer freebsd_triage 2023-10-02 05:25:13 UTC
(In reply to Anatoliy Nebrat from comment #14)

I still need to see mpd.conf.
Comment 16 Anatoliy Nebrat 2023-10-07 10:44:57 UTC
(In reply to Eugene Grosbein from comment #15)
default:
        load server
        load pppoe
server:
        log -all
        create bundle template B
        set ipcp ranges 195.../32 ippool ppp_free
        set ippool add ppp_free 172.17.1.1 172.17.254.254
        set ipcp yes vjcomp
        set ipcp dns 1.1.1.1
        set iface disable on-demand
        set iface disable proxy-arp
        set iface enable tcpmssfix
pppoe:
        create link template LPPPoE pppoe
        set pppoe service ""
        set link action bundle B
        set link disable multilink
        set link yes acfcomp protocomp
        set link no pap chap
        set link enable chap
        set link keep-alive 5 30
        set link yes report-mac
        load auth

        # vlan1
        create link template vlan1 LPPPoE
        set pppoe iface vlan1
        set link enable incoming
        # vlan200
        create link template vlan200 LPPPoE
        set pppoe iface vlan200
        set link enable incoming
        # vlan201
...
        # vlan399
        create link template vlan399 LPPPoE
        set pppoe iface vlan399
        set link enable incoming

auth:
        set auth disable internal
        set auth enable radius-auth
        set auth enable radius-acct
        set auth acct-update 10
        set radius server 192... test 1812 1813
        set radius timeout 30
        set radius retries 3
        set radius me 192...
        set radius identifier 192...
        set auth update-limit-in 5000000
        set auth update-limit-out 5000000
Comment 17 Dmitry Lukhtionov 2023-10-09 06:19:04 UTC
Can you create this section in mpd.conf ?

startup:
        set user mpd mpd admin
        set web self 127.0.0.1
        set web open
        set console open

after this, connect with telnet to address 127.0.0.1 port 5005
or through web to address 127.0.0.1 port 5006
with username `mpd` and password `mpd`


and run command
#show mem

and see like that:

Mpd pid 393, version 5.9
[] show mem 
   Type                              Count      Total
   ----                              -----      -----
   AUTH                               1981     164022
   BUND                                356    3520768
   CMD                                   4         74
   CMDL                                  6        172
Comment 18 Eugene Grosbein freebsd_committer freebsd_triage 2023-10-09 11:02:19 UTC
(In reply to Anatoliy Nebrat from comment #16)

Please show memory stats as Dmitry requested. Also, you may remove "log -all" command as that was a work-around to a problem solved long time ago.