[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.