[RPi4 1GB] LibreELEC 12 clash between WiFi and CEC

  • Hi,
    I've seen people talking about issues with LE12 for WiFi and for CEC separately, but I haven't seen someone mention this issue.

    If WiFi is connected AND CEC is enabled it will just crash constantly.. seemingly in about 30 seconds.
    If WiFi is disconnected or Ethernet is connected and CEC is enabled things seem to work fine.
    If WiFi is connected and CEC is disabled things (mostly) work fine - it might randomly freeze after an hour or two, or not at all.

    How I discovered this:

    I did a fresh install of LibreELEC 12.0 on a new SD card for a RPI4 (upgrading from a RPI3 I'd been using with LibreELEC flawlessly for years), and set it up, scanned the library etc with ethernet connected, but as soon as I tried WiFi the problems arose. I tried another install on a different SD card and RPI4, but was the same.

    Then I noticed if I plugged the micro HDMI into the second port it didn't crash as often. But I needed CEC to work, so I changed the settings and the issues came back.
    So I did those tests above to narrow down the issue.

    When 12.0.1 was available I tried upgrading, and have subsequently tried a couple of the nightly builds, including the latest (LibreELEC-RPi4.aarch64-12.0-nightly-20240917-7de0439.img) in the hope the issue would be fixed but it still persists.

  • Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem
    4. Generate a log URL (do not post/upload logs to the forum)

    use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link
  • Thanks for the prompt response.

    I did that and replicated the problem. That's pretty easy as it almost happens immediately - to the point I have to rush into settings to turn either WiFi or CEC off or I won't get a chance.

    I did the paste system logs, there was two options - the crash log and normal so I did both.

    Crash version:
    https://paste.libreelec.tv/ethical-sawfly.log

    Normal:
    https://paste.libreelec.tv/proud-flea.log

    Then I thought maybe I should replicate it with the default skin just in case.

    Crash version:
    https://paste.libreelec.tv/fluent-snail.log

    Normal:
    https://paste.libreelec.tv/stirred-rat.log


    I noticed on the debug display when WiFi and CEC were both on the FPS would drop to 0.3, and the Kodi-CPU would shoot up to nearly 200%, and that is not even doing anything, just in the menu.

    Thanks again.

  • It seems you are using a RPi4 with only 1GB of RAM and according to the logs it's running out of memory.

    Try adding the following line to the end of /flash/config.txt

    Code
    dtoverlay=cma,cma-384

    so long,

    Hias

  • if #4 doesn't work, you can also create a swap file to increase RAM:

    Iridium
    April 14, 2019 at 6:09 PM
  • I edited that line into config.txt and it stops it from crashing immediately. So I tried watching a movie - it froze about 18 minutes in, but then on the second attempt made it all the way through.

    So, it seems manageable for now, so thanks again. Hopefully the root issue will be resolved in further updates, just wanted to raise awareness of it.

  • It looks like from the log, the video that was playing when it crashes was using ffmpegdirect addon.

    Do you get crashes when playing local content, or is it only videos using ffmpegdirect?

    I'm not sure if ffmpegdirect causes significantly more memory usage.


    A simple way to reduce some memory is to disable caching. In settings/services/Caching, set buffer mode to no buffer.

    A lighter skin may be helpful.

    So, it seems manageable for now, so thanks again. Hopefully the root issue will be resolved in further updates, just wanted to raise awareness of it.

    Unfortunately this is just feature creep in kodi. Each version released tends to demand more memory.

    A few releases back it was feasible to run kodi on a 512M pi, but that hasn't been possible for some time.

    More recently, I'd say 2GB is needed for 4K kodi, and 1GB is okay for 1080p (*).

    But it depends on the exact configuration. Using certain skins or add-ons may make even 1080p usage on 1GB unreliable.


    (*) Note the workaround of "dtoverlay=cma,cma-384" will stop some 4k hevc content from being played, so isn't something that is going to be fixed. You make find "dtoverlay=cma,cma-320" is better for your situation.

  • Thanks again for the response popcornmix, and for the detail.

    It looks like from the log, the video that was playing when it crashes was using ffmpegdirect addon.

    Do you get crashes when playing local content, or is it only videos using ffmpegdirect?

    I'm not sure if ffmpegdirect causes significantly more memory usage.

    No, there was nothing playing - that was my point, it was just sitting on the menu screen, or scrolling it. If you turn on both WiFi and CEC it will just freeze in less than a minute. So I thought there must be some conflict between them or some memory leak, because I didn't think they would use that much memory on their own.

    The second lot of logs I posted where it crashed was just the default skin.

    I'm not that concerned with play 4K content at this stage, in fact a lot of my files are only 720p.

  • Ok, I spoke too soon about the crashing seeming to have settled down - after I did the previous post I went to have something to eat so I turned on the TV and RPI, then went and got the "things I was going to eat" (not sure why the word for that is a censored word, but ok).

    Came back and it was frozen on the home screen.
    Rebooted and then tried playing a youtube video, and it froze a few minutes in.
    So I guess I'll have to try some of those other settings.

  • Hmm good point. Is there a previous version of LibreElec (for RPI 4) you can recommend to go back to that doesn't have this issue of the WiFi using up all the memory?
    I've been using LE on the RPI 3B for years without issue (currently on 9.2.8). Just thought if I was setting up a new one it would be best to go with the latest.

    Thanks to all you guys for the help and the good work.

  • To my knowledge, you're the first RPi4 1GB user here, so we only have experimental recommendations.

    Going back to an older version will probably not solve the problem (you've already reduced the cache size without luck).

    You said it works fine without WiFi, and obviously you don't want to create a swap file. Then try this:

    Switch WiFi off, and buy a WiFi-to-Ethernet adapter: https://www.amazon.com/dp/B07Z1SGWL5

  • Ah ok. Well I wouldn't want to kill SD cards with constant read/writes.
    The RPI 4 has higher specs, but the RPI 3B+ has had no issues with earlier versions, so I thought rolling back might help.
    Just didn't know if there was a version where things related to that issue may have changed so I didn't have to trial and error it.
    Thanks anyway. If I can't get an ethernet solution I'll try and test some things I guess.

  • Just an update on this after some further tests.
    LibreELEC 12.0.1 works fine on the lower specced RPI 3B+ under the same conditions as above.
    LibreELEC 11.0.6 works on the RPI 4 also with those conditions (although the occasional prompt for wifi pwd, which seems to be a known issue)

    Both the RPI 3 and 4 have 1Gb RAM, and I haven't changed that cache setting, or anything else.
    So it seems like the implementation of the WiFi code on LE12 for the RPI4 has some issues with memory leak/hogging.

  • So it seems like the implementation of the WiFi code on LE12 for the RPI4 has some issues with memory leak/hogging.

    I haven't seen such issues at the logs, so I assume LE 12 just uses more RAM. Unfortunately you don't want to fix it by creating a swap file. /shrug

  • I haven't seen such issues at the logs, so I assume LE 12 just uses more RAM. Unfortunately you don't want to fix it by creating a swap file. /shrug

    But LE12 works fine on the RPI 3 which has the same amount of RAM. All I'm doing is reporting what works and what doesn't, I thought that was being helpful.
    Destroying SD cards and having to reinstall the whole OS because of a software issue doesn't seem like a good solution, but maybe that's just me.

    If I had a RPI4 with 2Gb of RAM and 1Gb of that was being used by WiFi I wouldn't think that was cool.

  • RPi3 runs at 32 bit mode, RPi 4 at 64 bit.

    It's good to report problems, but we have to be more precise before developers get active.

    So if you create a swap file just for testing, we could figure it out, and devs might start working.