Accumulating memory consumption in MPD while streaming to Icecast

I’m trying to troubleshoot why MPD is slowly increasing in memory as it streams to Icecast from the same DietPi machine.

I’m using the default MPD and Icecast2 from dietpi-software. I’m using myMPD as client, with its settings as Jukebox hopefully continually running 24/7. MPD is configured to output an mp3-encoded shoutcast stream which Icecast2 receives.

myMPD and Icecast look fine but when I check MPD through dietpi-services the memory slowly increases until the service stops responding at 2.1GB. I’m using a 4GB Pi4. I can remedy this by manually restarting MPD service but this is not an ideal workaround.

Below are the logs and possibly-relevant mpd settings. Hoping someone has ideas on how to troubleshoot.



 ● mpd.service - Music Player Daemon
│      Loaded: loaded (/lib/systemd/system/mpd.service; disabled; vendor preset: enabled)
│     Drop-In: /etc/systemd/system/mpd.service.d
│              └─dietpi-services_edit.conf, dietpi.conf
│      Active: active (running) since Mon 2022-02-28 01:31:25 JST; 5h 57min ago
│        Docs: man:mpd(1)
│              man:mpd.conf(5)
│              file:///usr/share/doc/mpd/html/user.html
│    Main PID: 39275 (mpd)
│       Tasks: 7 (limit: 4472)
│      Memory: 727.1M
│         CPU: 53min 17.090s
│      CGroup: /system.slice/mpd.service
│              └─39275 /usr/bin/mpd --no-daemon

sample log error when 2.1GB reached
│ Feb 28 07:35:10 musicpi mpd[39275]: exception: Failed to play on "music stream" (shout): Lost shout
│ connection to localhost:8000: Socket error


# An example of a shout output (for streaming to Icecast):
audio_output {
        type            "shout"
        encoder         "lame"          # optional
        name            "music stream"
        host            "localhost"
        port            "8000"
        mount           "/mpd.mp3"
        password        "hackme"
#       quality         "5.0"
        bitrate         "128"
        format          "48000:16:1"
        protocol        "icecast2"              # optional
##      user            "source"                # optional
        description     ""     # optional
##      url             ""    # optional
        genre           ""                 # optional
##      public          "no"                    # optional
##      timeout         "2"                     # optional
##      mixer_type      "software"              # optional

input_cache {
        size "256 MB"