Intermittent crash watching video

My RPi 1B has been experiencing some random but infrequent OSMC crashes for over a year now. These occur whilst watching video stored on a network disk but not when listening to music stored on the same disk. They are always characterised by the picture freezing/sound stopping without warning and by a lack of response to the remote control and to ssh requests. Therefore, the only way out is to switch the power off, which is not something I like doing without a proper shutdown.

Other forum topics describing similar symptoms appear to reach no conclusion as to the cause or solution. Given that I do not use OSMC regularly and the infrequent nature of this problem (I have recorded 7 such crashes in 13 months) I have therefore been trying to ignore it, but have finally decided that I need to sort it out. I have enabled debug logging and will switch the device off after each use to prevent the logs getting too big. The next time it crashes, I will upload full logs and supply the details required by “How to submit a useful support request”.

In the meanwhile, I wondered if there was anything else I could usefully do to help with identifying the cause of the crash when it occurs, since I realise how difficult it can be to diagnose intermittent faults such as this.

Many thanks in advance for any help you can give.

John

If that wasn’t a typo and you really are using an original RPi model B I would respectively submit that it has lived a good life and go for an upgrade. Compared to a 3B+ that thing is painfully slow and eight years on is due for retirement. It is also very likely to have a hardware fault as those early models had issues with poor contacts on the SD slot and polyfuses that would break down and cause problems.

No, it wasn’t a typo. I know it may be at the end of its useful life and that the solution may be a new RPi. But I planned to do some systematic troubleshooting first to ensure (hopefully) I understood what the problem was before taking this step. It would be annoying to buy a new unit and find that the problem still existed.

My plan is

  1. Get somebody who understood these things to review the logs following a crash to see if there was any hint as to the cause. I realise this is probably a long shot with this sort of crash but would still like to do it, if somebody would be prepared to take a look.
  2. Get a new power supply, since a PSU fault is often suggested as a cause of unexplained problems and I would need a new one for a new RPi anyway.
  3. Try a new memory card.
  4. If none of the above work, assume the fault is on the RPi board buy a new one.

But thanks for mentioning polyfuses. It was so long ago that I had completely forgotten the issues with these on the RPi1 boards. This seems to me quite a likely cause of my problem. So I will add checking these (and shorting them out if necessary) to the top of my list.

John

Instead of purchasing a new SD card I would use h2testw.exe instead if you have a PC and a card reader.

The annoying thing about buying a new unit would be more likely the fact that you would want a 3B+ even though the 4 is only slightly more with better specs but isn’t going to be as good of Kodi platform for at least a year from now. A new unit would likely necessitate a new PSU and SD anyway due it higher current needs and different form factor respectively so going clean with the OS would probably make sense.

Thanks for the SD card advice - I’ll try that before purchasing a new card. With regards to polyfuses, I have found that it is impossible to test these under normal operating conditions (RPi in a case and attached to the back of the TV, which gets quite warm). And obviously, if I remove the RPi from the TV and open the case to allow testing, it will run much cooler and any problem is unlikely to appear. So, to eliminate this as a potential cause, I have shorted the main (F3) polyfuse, returned the RPI to its normal location and will now sit and wait for the next crash. If one occurs, I will post back here with logs.

John

Just when I was starting to think that shorting the polyfuse had resolved the problem (approximately 6 weeks and 75 hours of video crash free), it crashed again last night (12/3/21 at around 20:48). After the crash, the on-screen debug display showed the following.

MEM: 184004/360264 KB - FPS: 1.3fps
CPU: #0: 0.0% (CPU-KODI 7.30%)

This display continued to update (so something must still have been running), with the FPS and CPU-KODI values changing by small amounts but the MEM and CPU#0 values changing not at all. I then switched the Pi off overnight and on again this morning to upload the logs, which may be found at https://paste.osmc.tv/gayetajijo. I would be extremely grateful if somebody who understands these things could review these logs to see if they reveal a likely cause of the crash (or indeed anything else that might be causing problems).

As ever, many thanks in advance for any help you can give.

John

This is just a guess, but I think you need to restart your MySQL server. It could also do with an update. I don’t think those older versions of MySQL work quite right with Kodi v18 and newer. I was on 5.5 for a very long time but switched over to a current version of Maria after running into some issues I can seem to recall off the top of my head. I’ve had no issues since.

It is most unlikely that I need to restart MySQL server as it is rebooted every day. It runs on my NAS (a Zyxel NSA310 of similar vintage to my RPi 1B), which is switched off every night and on again the following morning. And I know it’s out of date, but the NSA310 only allows installation of packages from Zyxel and, since they consider this device obsolete, this is the latest version they supply.

More importantly, did the logs (or the very odd CPU values on the debug display) give any hints as to the cause of the crash? Or has nobody had a chance to take a look yet?

Thanks,

John

The system log is not persistent across reboots so the only thing from that crash to go off of would be the kodi.old.log and that does not appear to provide any insight, other than MySQL errors. If the crash was just Kodi and you still had the ability to ssh into your RPi then doing a grab-logs -A at the terminal may have provided a more valuable set of logs to go off of.

The MySQL database really should be on a server that is always available! Kodi will try talking to the database and will hang/do-strange-things if it can’t see the database. If the Pi is always on, consider moving the database there. That will also allow you to have an up to date version of MySQL (or Maria)

@bmillham
Thanks for this, but I am aware of the issue. My wife has an aversion to leaving any mains powered devices on overnight. Therefore the whole network is closed down every night (first the RPi and any other mains powered computers on the network, then the NAS and finally the router) and rebooted the following morning (router first, then NAS and RPi and other computers last). So as far as the RPi is concerned, the server is always available.

@darwindesign
Sadly it is not just Kodi that crashes. As I indicated in my original post, following a crash there is no response to a remote control (either an IR one with USB attached receiver or the Official Kodi Remote app running on iPhone or iPad) or to SSH requests. Therefore, I am unable to run grab-logs -A and, as far as I know, have no option other than to switch off at the plug. Although, as noted previously, something must still be running as the debug display continues to update. And I seem to remember that it still responds to ping after a crash, so the network interface is active. But I’m not sure either of these help in any way to resolve the issue.

So, unless you have any other suggestions, I will move on to step 2 of my troubleshooting plan and get a new power supply, suitable for a RPi 3B+ if that is required. I will then wait for another crash and post back here if one occurs.

Thanks for reviewing the logs.

John

I bought a new power supply (official Raspberry Pi PSU) but the Pi crashed again during the first video I played after installation. So I moved on to testing the SD card with h2testw, as suggested by @darwindesign. After deleting the Linux partition, expanding the FAT32 partition to fill the whole card and reformatting it so that it could check the whole card (I assume this was the right thing to do?), I ran h2testw on all available space (reported 7577MB for a nominal 8GB card) and the test finished without errors. I concluded that the problem did not lie with either the power supply or the SD card, so I ordered a new RPi 3B+, which arrived yesterday. But before I start to set it up, I have been thinking about how best to do it, as I realise much has changed since I first set the system up with raspbmc more than 8 years ago.

Firstly, since I do not need a shared library database, I assume I should use the Kodi database on the Pi to eliminate the problem with the obsolete but un-updatable MySQL version I am currently using on my NAS. Or are there any better solutions?

Secondly, I have always used smb filesharing to access the media on my NAS (this being its default filesharing protocol). I have no idea what version it uses (or how to find out), but I know there have been issues about smb security and interoperability of different versions recently. For me, it has always worked perfectly, but is there anything I need to consider when setting up sources on my new machine?

As ever, any advice on these two questions (or on any other potential pitfalls that you think I have missed) would be very much appreciated. Thanks in advance for your help.

John

There really hasn’t been much of a change on how any of this works in the last eight years. If you don’t need the functions of MySQL you just don’t add those lines to advancedsettings.xml and Kodi just uses SQLite on the RPi itself and that will work just fine. As for sources it is still the same as it ever was. If you were using TVDB you may want to use this as an opportunity to switch to TMDB as your TV show scraper. There is an option to mount your file share on the operating system and then point Kodi to the local mount instead of using Kodi SMB paths but honestly this would be doing work for little to no gain on a 3B+ as it is not capable of playing anything large enough to cause a bandwidth issue in most setups.

Many thanks for this. It has put my mind at rest, especially with regards to smb, where, given all the problems other people seem to have had with it, I thought I might be storing up future problems for myself.

Thanks also for the TVDB suggestion. I have always used TVDB and not had any problems, so was unaware there were issues, but searching the forum revealed quite a lot. I found that Kodi has changed its default TV scraper to TMDB and as far as I am concerned, it doesn’t matter which I use, as long as it works of course. But I did note that in November 2020 you were still using TVDB (Scraper TheTVDB will be switching to a subscription based payment model - #7 by darwindesign) due to problems with older shows, which I suspect may well apply to me too. What are your current thoughts on this? And is there any way to determine if TMDB will be OK for my media, other than just try it and see?

John

There are situations where issues come up but you need to remember that this being primarily a support forum you can get a distorted view of how common an issue is. If an issue ever did come up you can always switch over to a system mount and just add a path substitution in advancedsettings.xml to redirect your current library over to that so I wouldn’t bother worrying about it.

TMDB has been getting better but the switch from TVDB isn’t without its issues. For newer shows discrepancies between the two are fairly rare but still exist so the ‘Missing Movies’ add-on is helpful to find these. For example Superstore had a special between season one and two. On TVDB this was listed as a special and the second season starts with the next episode after that. On TMDB this episode is currently listed as both a special AND the first episode of the second season thereby offsetting the numbering of each episode by one in comparison. I’m still not a fan of TMDB’s refusal to allow movies to exist as specials. IMO Bandersnatch belongs as part of the Black Mirror TV show, and not in Movies.

As for the older stuff this is a bit more of a pain. In situations where a fix is not as easy as just renaming a couple files I have resorted to using TinyMediaManager to scrape them using TVDB which generates nfo files. In this way I can have thing like Miss Marple as a single TV series (TVDB) instead of a collection of various series and movies (TMDB) which is just a mess. I had two or three shows that were problematic importing in using the nfo’s (I didn’t investigate why) but that was sorted by just going into sources>file>[series folder] and did a context menu>change content and changed the scraper on those shows to ‘local information only’.

Many thanks for this detailed reply. It looks like the choice between the two scrapers is not straightforward and will depend entirely on the individual TV Shows that I have in my library. Luckily it is not that big (around 20 series), so I think I will probably go though each one on the TMDB website to assess whether it is likely to scrape OK. If the vast majority will, then I’ll use TMDB, since this looks like the preferred future direction for Kodi. If not, I’ll stick with TVDB, which I know works with my content, until something happens to force a change and/or investigate the use of TinyMediaManager and nfo files.

All I need to do now is find some time to get the new system set up!

John

My collection is over 250 series so a bit more of a effort to sift through. There is actually another option which is exporting your Kodi library to individual files after you have scrapped everything in correctly. This process produces similar results to what would come from TMM.

Since my library is currently scraped OK on the old Pi, exporting the library sounds a very good and simple option if I run into problems with scraping TV Shows on my new system. Is this function built into Kodi or does it require an add-on?

It is built into Kodi.

https://kodi.wiki/view/Import-export_library/Video#:~:text=In%20settings%2C%20select%20Export%20library,artwork%2C%20do%20not%20export%20artwork.

Note that part of what gets exported is a link to the data source which would get used for scraping new episodes that show up without nfo files for them. This can pose a problem if you change your scraper later. If you run across this issue for any particular show (ie new episodes not scraping) you can always bring up the information window for the show (not an episode) and click “refresh” and then select yes when it says it found local info and if it should scrape from online instead. This will make it ignore the nfo file that you have saved and bring in the info from the new scraper. If you have Kodi export the library again (replacing files) the changes to your scraper from the refresh will be reflected in the updated nfo file.