-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash after many PVR timer updates #18402
Comments
It is worth testing with Kodi master as Kodi 18 may not see any more updates. |
Throws in main thread whike trying to copy a std::string, which leads to ABORT. I doubt that this is related to PVR timer updates.
|
UPDATE: recent crash history: I have summarised the logs as follows:
Please see here Let me know if there is any further info you need |
Have you considered checking with the MythTV PVR addon maintainer? You seem to have a great deal of timers, and quick look at the v5.10.16 code for that addon would indicate that the timer ids should never go negative. Note this in your original debug log (line 1995):
It crashes not long after the index goes negative both times. If I found the correct place in the addon code, the maximum value for an ID that isn't a recording is 0x7FFFFFFF, so they should always be a positive number in the Kodi log. Also note the drastic change in number range, up until they go negative they never seem to exceed 15000 or so. It could very well be that the amount of timers you have is exceeding some internal limitation in the addon and it starts sending bad strings to Kodi. The repo I found for the addon v5.10.16 was here, not sure if it's the primary developer or not: https://github.com/janbar/pvr.mythtv |
Thanks for looking into this. I have turned on additional debug info for the mythtv-pvr plugin and will pass this on to that team next time it crashes...... |
latest crash (mythtv-pvr specific logging, no kodi debug logging) here |
I've had this issue for years, but it's pretty much disappeared when running LibreElec 9.2.5. Went over 21 days with no crashes whereas before that I'd be lucky to make it to 2. |
Exact opposite in my case. I have also been running for years and don't recall seeing this issue until I moved from Raspian and an earlier version of kodi 18.x to LibreElec 9.2.5. |
Dont want to get too off-topic, but do you have your CEC adaptor set to power off your TV when the screensaver activates? Around when I stopped having regular crashes when using only the MythTV plugin on Kodi, I'd also swapped to using https://kodi.wiki/view/Add-on:Turn_Off to handle CEC power off. |
No, the screensaver does not turn off the TV via CEC (although not a bad idea, I didn't know that was possible). As of now I have not had it crash with both mythtv-pvr extra logging AND kodi debug logging, still waiting..... |
UPDATE:
notes: 1 & 2 may not be needed, screensaver has not kicked in prior to turning off. I now have a 526Mb log file which I have summarised (section ommited indicated by ---- SNIP) see here |
Is the system running out of memeory? |
Is a char* passed that has no \0 terminator? Edit: I also think of a memory leak. If that's the case we should see something in dmesg if OOM was involved. |
@CoolDreamZ Executing |
@mglae will do, thanks |
LATEST CRASH |
UPDATE Latest 10 crashes Date: Fri Oct 16 03:27:12 BST 2020
I have summarised the logs as follows:
Please see here [amusingly pastebin thinks my log files are potentially offensive!] |
It could be caused by threads competition on a GUI label of the current screen page. One consumes the string and an other change it at the same time (probably because some timers have been updated). |
In the crash logs provided so far I cannot see any actions like that. |
UPDATE: The system has continued to crash every 1-2 days so I created a fresh installation of:
and restored a backup of the previous 9.2.5 installation into it. The system crashed a few hours later (on the main TV page) here is the log |
Hi, the log show the root cause:
|
Aha, and what exactly goes wrong in this method and where (source code line, please). I unfortunately cannot find anything suspicious there. At the end, a string assignment goes wrong. This can have different reasons. |
http://www.cplusplus.com/reference/string/string/assign/ => "If the resulting string length would exceed the max_size, a length_error exception is thrown." So, it could be a very large string causing the problem. Hmm. |
#9 0xb4d57c44 in std::string::assign(std::string const&) () from /usr/lib/libstdc++.so.6 And even more strange is that the log indicates, that the string copy function causes the error. So, the "too long" string must already exist in the source object as length of source and copy should be identical, this all does not make any sense to me. |
memcpy gets: while 0x80000000 here is intepreted as a negative number, while memcpy uses it unsigned. I see that the original method hands in pointers to strings. Is there a chance that the string at this position vanishes and just the ptr (which was passed in by value) remains to this position and Copy just reads from garbage? |
The crashing method bool CPVRGUIInfo::GetLabel(std::string& value, const CFileItem* item, int contextWindow, const CGUIInfo& info, std::string* fallback) const
{
return GetListItemAndPlayerLabel(item, info, value) ||
GetPVRLabel(item, info, value) ||
GetRadioRDSLabel(item, info, value);
} |
Okay, then it's the assignment that happens in GetPVRLabel. Here we actually copy stuff into value. Perhaps a very simple approach of adding some prints to exactly see which value is copied into it, might shed some light? |
I don't fully understand the code in GetPVRLabel, but I see here that some shared_ptr might potentially point to nullptr, but e.g. info.GetData1() is called never the less. Most methods here return true, some even if no copy (assignment) has happened. I don't know this code, therefore it might just use a fallback in that case. |
This is perfectly okay. I know the code very well. The potential nullptr is passed only to methods designed to handle this case properly. |
Okay. As the problem seems to happen during a normal string copy operation (e.g. assignment), there might be just some \0 missing in one of the supplied data. What we could try: limit the amount of chars we copy in that method, e.g. Create a temporary string with max length of 1000 and assign that one? If the bug is still triggered, we have some stack corruption. I don't really see another trap to detect this bug more easily. |
E.g. assign inputstr.substr(0, 1000); |
The real question is how to provide a test build for the issue submitter. He's using libreelec. I'm out in this case. I long time ago stopped building LE myself. |
Posting a simple patch should be fine. LE maintainers should step up and provide that for their user I think. |
I have upgraded to Kodi 19.4 via LibreElec 10.0.2
The crash is still happening when left unattended on the "TV" main menu page.
The last few lines in the log are:
|
The throw exception is typically caused by a vector reallocation. And the code still reference a pointer to the old memory segment. |
This issue is now marked stale because it has been open over a year without activity. Remove the stale label or add a comment to reset the stale state. |
Bug report
Describe the bug
kodi is crashing regularly (approx once per day) whilst unattended. I had a look at the logs (see below) and deduced that the problem may be related to PVR timer updates and so I set logging to debug (including the PVR component). The system crashed a few hours later. Other than the crash I have not observed any other issues.
Expected Behavior
The system should not crash
Actual Behavior
System crashes regularly.
To Reproduce
Unable to reproduce on demand but will happen within a day or so. I noticed 190 cycles of 795 pvr timer updates in the log.
Debuglog
The log file was 15M so I had to shorten it by removing 188 pvr timer cycles
debug log
Here is a summary of the 190 pvr timer cycles:
pvr timer cycles
Your Environment
Used Operating system:
Android
iOS
Linux
OSX
Windows
Windows UWP
Operating system version/name: LibreElec RPi4.arm-9.2.5
Kodi version: 18.8.0
The text was updated successfully, but these errors were encountered: