Playling Playlist dies after about 7 minutes - possible memory leak?

(Note: there is a copy of this thread on the Kodi forums: link)
Hi everyone, and thanks in advance for your help,

I am running OSMC 2021.12-1 (kernel: Linux 5.10.78-2-osmc) on a Raspberry Pi CM4 (2GB RAM, 32GB eMMC storage) and on the carrier board ‘TOFU’ (oratek).

I am using the skin Estuary and no special add-on to my knowledge.

Issue:
I have some custom-made m3u playlists that point to files stored in the SSD drive. When I read them, everything works perfectly for about 7 minutes, then I get a blue screen with a frowny face and Kodi restarts. The log file seems to point to an ffmpeg error with memory allocation on the heap.

The error always arises when switching from one video to another in the playlist, but happens regardless of the video (the playlist is randomized). The error is always identical. Here is the log.

The error is at the end of that log and is the following:

2022-01-21 14:34:33.951 T:1510     INFO <general>: ffmpeg[(nil)X]: Failed to alloc 12533760 from dma-heap(fd=176): 12 (Cannot allocate memory)
2022-01-21 14:34:33.951 T:1510    ERROR <general>: ffmpeg[(nil)X]: [hevc] v4l2_request_hevc_start_frame: Failed to get dst buffer

I found only one thread online with a similar issue here (I also have 4k video). But the “cma-512” solution was already in my /boot/config.txt as shipped by OSMC.

I tried creating a swap file to no effect (still same error after same amount of time).

I am out of ideas here as to what I could test, would anyone be able to help?

Many thanks,
Nara

Hmm. have about the same issue. Didn’t time it to 7minutes though.
My logs showed nothing (I admit, I’m not running in debug mode). Running the same skin estuary.
Kernel:$ uname -a
Linux vero4k2 4.9.113-60-osmc #1 SMP PREEMPT Sun Dec 19 23:56:28 UTC 2021 aarch64 GNU/Linux
And running on a vero4k2+.

The files are mounted through NFS partition/fstab - hence it seems local to kodi.
Playlist is the format: more than 3 stars, so it is dynamically extracted songs.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>3 Star</name>
    <match>all</match>
    <rule field="userrating" operator="greaterthan">
        <value>2</value>
    </rule>
    <order direction="ascending">random</order>
</smartplaylist>

It rather seems to be a kodi issue though. Files are regular ripped mp3’s (variable bit).
Movies work all fine.

We did some digging in the Kodi forum thread, and we found that the issue doesn’t happen in LibreELEC.

They seem to suggest the main difference in ffmpeg between LibreELEC and OSMC (at identical Kodi versions) is that LibreELEC has a patch that optimizes memory.

I’d like to try applying that patch to ffmpeg in OSMC to see if that fixes the issue, but I don’t know how to do it. Could anyone here give me some pointers?

Thanks!

We can synchronise with the GBM Matrix branch after Kodi v19.4 is released and hit that. Thanks for bringing it to my attention.

I am seeing a similar issue on a Pi 3B+ with playing a continuous slideshow of pictures and videos, I have an autoexec.py file which adds them from a folder. Things were fine with the 2021.11-2 version and after I upgraded it, Kodi would freeze after a few hours. I started afresh with the 2021.12-1 version, and that does the same. The processor load values seem to creep up slowly over time. Will logs be collected in such cases if I enable that?

Mon Jan 31 07:40:05 CST 2022
Kodi Version: 19.3
OSMC VERSION_ID=“2021.12-1”
temp=63.4’C
07:40:05 up 14:18, 1 user, load average: 2.22, 2.20, 2.18

Showing photos shouldn’t be affected unless videos also exist in this playlist.

The folder that I am copying the files from does contain both photos and videos. Digital picture frames do not seem to allow display of both together, it is one or the other, so OSMC/Kodi is a great alternative. For a while, with Kodi 18, that feature was lost, but fortunately it was restored later. With Kodi 17, I could even have background music which would stop during videos and restart for the pictures, but that feature was apparently something unintended and could not be brought back!

I tested with the latest OSMC release, and the display seems to freeze with the very first video. With the earlier releases, it would take more time. The 2021.08-1 version seems to be the only version which works properly. Now that Kodi 19.4 is incorporated, can this be looked into? Thanks.

After Debian Bullseye is released, I can merge further upstream changes, but this is lower on the list of priorities at this time

Sam