Kodi Community Forum

Full Version: OSMC/Kodi freezing, [Errno 12] Cannot allocate memory in log
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I run Kodi using OSMC on a RPi 3B.  About once a week, I'm encountering a problem where the Pi locks up.  It can be pinged, but I can't SSH into it.  It's unresponsive to keyboard inputs.  I was able to locate "old" Kodi logs from that date.  Below is an excerpt:

2021-01-27 23:34:01.240 T:1916207120  NOTICE: Samba is idle. Closing the remaining connections
2021-01-28 02:52:09.924 T:1552883936 WARNING: Unable to determine channel type. Defaulting to TV.
2021-01-28 03:28:03.968 T:1689243872 WARNING: Previous line repeats 612 times.
2021-01-28 03:28:03.968 T:1689243872   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.OSError'>
                                            Error Contents: [Errno 12] Cannot allocate memory
                                            Traceback (most recent call last):
                                              File "/usr/share/kodi/addons/script.module.osmcsetting.updates/service.py", line 38, in <module>
                                                m = update_service.Main()
                                              File "/usr/share/kodi/addons/script.module.osmcsetting.updates/resources/lib/update_service.py", line 244, in __init__
                                                self._daemon()
                                              File "/usr/share/kodi/addons/script.module.osmcsetting.updates/resources/lib/update_service.py", line 270, in _daemon
                                                self.update_now()
                                              File "/usr/share/kodi/addons/script.module.osmcsetting.updates/resources/lib/update_service.py", line 898, in update_now
                                                if self.check_for_unsupported_version() == 'alpha': return
                                              File "/usr/share/kodi/addons/script.module.osmcsetting.updates/resources/lib/update_service.py", line 1500, in check_for_unsupported_version
                                                process = subprocess.call(['/usr/bin/dpkg-query', '-l', 'rbp-mediacenter-osmc'], stderr=fnull, stdout=fnull)
                                              File "/usr/lib/python2.7/subprocess.py", line 172, in call
                                                return Popen(*popenargs, **kwargs).wait()
                                              File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
                                                errread, errwrite)
                                              File "/usr/lib/python2.7/subprocess.py", line 938, in _execute_child
                                                self.pid = os.fork()
                                            OSError: [Errno 12] Cannot allocate memory
                                            -->End of Python script error report<--
2021-01-28 08:29:43.843 T:1552883936 WARNING: Unable to determine channel type. Defaulting to TV.

I've posted this problem on the OSMC forum here.  There is a suggestion that it may be a Kodi issue, so I've decided to post it here as well.  Apologies if I've posted here in error.

Thanks for any help.
(2021-01-30, 21:17)FrogFan Wrote: [ -> ]Below is an excerpt:

Please don't plaster any log files directly into the forum. Providing the FULL log via a pastebin link is much more useful, like you already did on the OSMC forum. It also doesn't burden our forum server.

2021-01-05 23:37:10.134 T:1916473360 NOTICE: Disabled debug logging due to GUI setting. Level 0.
Also enabling debugging in Kodi will provide a more detailed log file when troubleshooting.

(2021-01-30, 21:17)FrogFan Wrote: [ -> ]Apologies if I've posted here in error.

Technical OSMC problems are best asked on the OSMC forum first. We normally give generic Kodi support here.
(2021-01-30, 22:12)Klojum Wrote: [ -> ]
(2021-01-30, 21:17)FrogFan Wrote: [ -> ]Below is an excerpt:

Please don't plaster any log files directly into the forum. Providing the FULL log via a pastebin link is much more useful, like you already did on the OSMC forum. It also doesn't burden our forum server.

2021-01-05 23:37:10.134 T:1916473360 NOTICE: Disabled debug logging due to GUI setting. Level 0.
Also enabling debugging in Kodi will provide a more detailed log file when troubleshooting.
(2021-01-30, 21:17)FrogFan Wrote: [ -> ]Apologies if I've posted here in error.

Technical OSMC problems are best asked on the OSMC forum first. We normally give generic Kodi support here.
I've seen small excerpts of log files posted here, so I thought that wouldn't be a problem.  I guess I was wrong.

The full log that you saw over at the OSMC forum is old and does not contain relevant information to this problem.  I'm unable to take a log when this problem occurs because the Pi is locked up.

I will enable debug logging in Kodi to get more information.

I posted here because it was suggested over at OSMC that this could be a Kodi problem, not an OSMC problem.  I will go back to OSMC and seek assistance until they tell me to get lost.
check the systemd journal and dmesg when this happens. Sounds like you simpy run out of memory
(2021-01-31, 08:39)wsnipex Wrote: [ -> ]check the systemd journal and dmesg when this happens. Sounds like you simpy run out of memory

Thank you for the suggestion.  I'm basically illiterate when it comes to Linux, so I doubt if these logs will help me much, but I'll have a look when the problem recurs just the same.  I just ran journalctl and saw that it skips from Jan 20 to Jan 28.  I'm not sure why that happened and it makes me wonder how persistent it is.  There was, however, a line in the output that was bolded that seemed to roughly correspond to error noted in the log snippet I posted above.

It seems pretty clear that I'm running out of memory, but where am I running out of memory?  I thought maybe the log snippet I posted would offer a clue, but evidently it does not.  There is a suggestion that a specific addon is the source of the problem, and one suggestion is to disable that addon to see if the problem recurs.  Instead, I've enabled debug logging.  I'll stand by with debug logging enabled until the problem recurs, then I'll capture and post Kodi logs somewhere to see if someone can help me. 

Thanks again for the suggestion.
it could be anything really. A debug log won't help much, since kodi doesn't track memory usage of _other_ processes on your machine.
But if you have lots of addons installed that is certainly going to use memory, so try disabling stuff
(2021-01-31, 22:39)wsnipex Wrote: [ -> ]it could be anything really. A debug log won't help much, since kodi doesn't track memory usage of _other_ processes on your machine.
But if you have lots of addons installed that is certainly going to use memory, so try disabling stuff

Thanks very much for your feedback and suggestions.

I understand memory problems are very difficult to diagnose.  I would have thought that the debug log would tell us when control was passed to an addon, and the name of that addon (and when Kodi regained control, from which addon, etc.).  If so, then once we know the name of the addon, then perhaps we could examine its log for clues or simply disable it.  That's what I was thinking, at any rate.  If the debug log does not tell us when control is passed to an addon and which addon, then I understand we're "in the soup", and I have to start disabling stuff until the problem goes away.  This problem seems to recur every 4 or 5 days, so depending on the number of addons I need to disable one at a time, it could take weeks or months figure out which one is at fault.  I don't mean to sound critical, I'm just thinking "out loud".

The only thing running on the Pi is OSMC.  I think have very few addons installed -- the most significant being NextPVR -- although it occurs to me that I don't remember how to identify all the addons I've installed in order to begin disabling them.  If you could point me to someplace where I could identify addons I've installed, that would be helpful in determining what to disable.

At this point, the only addon I really need is NextPVR.  Stated differently, if I can't run NextPVR, then at this point OSMC (and Kodi) is useless to me.

Right now, I don't have enough evidence to post anything over on the NextPVR forums, but I will monitor its logs and try to find something in them the next time this happens.  For completeness, I'm using v5 of NextPVR and I recently enabled comskip.  Comskip didn't seem to have any connection to the Pi, so I've been doubting that it could be causing my problems, but I can disable that I guess.

Thanks again for your assistance and interest.
(2021-01-31, 23:31)FrogFan Wrote: [ -> ]I have to start disabling stuff until the problem goes away.  This problem seems to recur every 4 or 5 days, so depending on the number of addons I need to disable one at a time, it could take weeks or months figure out which one is at fault.  I don't mean to sound critical, I'm just thinking "out loud".

Probably best to go with a clean install and just install NextPVR.

As you're only running OSMC on the Pi, have you considered LibreElec? I've never tried OSMC, so I'm not criticising it. However, LibreElec has been very stable for me on Pi3B and Pi4B systems.
(2021-02-01, 10:31)mcelliott Wrote: [ -> ]Probably best to go with a clean install and just install NextPVR.

As you're only running OSMC on the Pi, have you considered LibreElec? I've never tried OSMC, so I'm not criticising it. However, LibreElec has been very stable for me on Pi3B and Pi4B systems.

I had to start fresh just over a month ago when my SD card failed.  I think NextPVR is the only addon I installed, but there are addons "enabled" by default when OSMC is installed. 

Thanks for the suggestion to try LibreElec.  I considered it when I opted for OSMC several years ago, and I can't remember why I chose OSMC.  Anyway, OSMC has been running with few problems for me and otherwise meets my needs very nicely.  I think I'll ride it out until I run out of memory again and see if I can get some help diagnosing the problem with full debug logs.