-
-
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
[epg] Sync epg update from client / db on startup #7367
Conversation
1.) My preferred solution for this is a boost::LockFreeQueue instead StringList insert_sql. 2.) Much easier is to implement is a lock on the StringList insert_sql (and the 2 others) for exclusive access: [code] What do you prefer? 1) Max performance or 2)Less changes? |
We generally try to avoid boost and minimize the usage of it so that mostly rules out option 1. I leave the rest of the discussion to the pvr people |
@Paxxi: Do you know if there is an kodi implementation of a lockfreequeue or similar using atomic operations? |
We should also avoid to even consider using the linked code :-) See the 2015-07-01 22:52 GMT+02:00 popcornmix notifications@github.com:
Fingerprint: 4606 DA19 EC2E 9A0B 0157 C81B DA07 CF63 1A99 5A9B |
thx for the link - I'll look over it |
I thought about this issue again. regarding the 2 stacktraces in http://forum.kodi.tv/showthread.php?tid=229401&pid=2029642#pid2029642 we have 2 threads accessing the database: 1.) 2.) Question is now: Why do we have to access the database for the 2. Thread? [Edit] I don't understand the purpose of the 2nd thread at all: |
And one more question: If Epg database is disabled in settings, should the table epg filled for any reason (I don't mean epgtags here)? Maybe to create unique epg ids? Currently the epg table is filled using thread 2 (but not over thread 1) Before I change these things it would be great if somebody can tell me the wanted concept, there will be many workflows I don't have any knowledge about.... |
|
@mapfau the only purpose of the EPG database is the ability to scroll back in time on the timeline (since many backends don't supply historic data). |
@Jalle19 thanks, this is one big piece of the puzzle! I thought it is because of performance options (what doesn't make sense as you need top bandwidth to view live-tv). I don't understad at all why the PVRManager calls EPGContainer::PersistTables. I would understad it if PVR needs an unique Epg Id, but this is not archived in EpgContainer::PersistTables (no EpgIds are updated from DB). |
I have removed Epg.h / .cpp changes because they are improvements. |
remind me of this one in the evening, then I can answer your questions |
@opdenkamp What I figured out so far without going too much into detail is:
Thanks for some short background information about this step! |
meh forgot to press send yesterday evening :) First this: the epg db is not only for the ability to scroll back, as @Jalle19 said, but also for some hardware that don't cache epg data and can only get epg data from the channel that they're currently tuned to, like pvr.njoy. Without the epg db, you would not have any epg data for a long time after a restart of Kodi. PVR code is very much tied to EPG code still. I've separated most of it (but not all) so it can be used independently at some point, even without PVR running, through it's own API (e.g. by one of the add-ons that now do a sort of timeline in python). But since it's not been separated completely (yet), PVR still needs correct epg tables linked to channels and vice versa. Which is not done in a very nice way atm ;-)
There are also some people who insist on using a shared mysql db for all of this, even though I've warned them quite often now that this is not supported by the code properly and will just cause each client to overwrite the other's data. To not cause too many issues for these (not so smart) people and not kill performance by having to check the last insert id on each query, we create all tables in the db at the start, when we can do it with the least amount of delay caused for users. Importing and persisting all tags takes a lot more time, so we do this later, after the channels import finished. |
I don't think a single minute of time should be spent making obscure and feature-incomplete addons like pvr.njoy to work, which pretty much leaves the ability to scroll back as the only reason why we have the EPG database. |
Then we think differently and the epg db is not going to be removed or gimped to just be used for scrolling back. It's a hardware limitation for that device, not software. |
I'm just saying that we have an endless stream of problems related to a feature that likely few people use (scroll back in the timeline) and even fewer people depend on (mythical pvr.njoy users), not the mention the group of people who just don't use it because their devices are too slow. |
You're just applying your own use case to the whole of PVR and want to strip everything you don't use yourself? :) I like the scroll back feature in combination with starting playback of something from the timeline that was recorded a few hours ago. Not sure what "endless stream of problems" you're talking about, because it's fine except for a couple of minor issues. Like the one being addressed here. There's also a big difference between what people think is a problem or slowness and what's actually happening. Like the epg import. If you remove the status progress thing for importing the epg data (not channels, just epg), then you'll see that most of the complaints will suddenly disappear. |
First of all I also use the feature to scroll back in the epg timeline and everything else what @opdenkamp said. So -1 for removing the EPG database.
I would say no, because we load the EPG from db in the main/pvr thread which blocks the PVR startup. I've created a PR #6937 which changes the EPG startup to be async but never finished it. IMO we don't need the EPG data to finish the PVR startup and doing it async will speed-up things a lot. |
@opdenkamp thanks for the backgrounds! I'll keep them in mind and consider them if I have time to go deeper in it.
The only thing wich must be evaluated is: Is the minute update time from the EpgContainer Process() loop a problem for PVR? |
For me the solution works well - I have not recognised any problems during the last weeks and stop therefore any further development on it.. |
Any ideas how to continue with this issue? I would love to see it merged in the official kodi repo as my system is not working at all without this patch. The latest PR has only minimal impact. |
return m_bCallPersistTables = !CSettings::Get().GetBool("epg.ignoredbforclient"); | ||
else | ||
copy = m_epgs; | ||
} | ||
return m_database.Persist(copy); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@mapfau imo we can merge it in after you've addressed my comment. |
btw please add |
@xhaggi Thanks for your comments. Pls look over the new commit... |
looks good thanks |
jenkins build this please |
@xhaggi , I have an OT question. I pulled the latest kodi commits from master branch wich requires pvr api version 2.0.1. I'm unable to make the pvr.hts client as it comes always with api version 2.0.0. Is there any trick? Sorry, my fault - wrong prefix.... |
jenkins build this please |
iirc we are now pointing to the master branch. i don't know why this doesn't work for you. |
I passed the wrong prefix=[] to the make call wich builds the pvr addon. |
np. build errors are unrelated. |
[epg] Sync epg update from client / db on startup
Is this issue present in Isengard15.1? After updating from 15.0 it crashes on startup. If I start without PVR (clean userdata) it crashes as soon as I enable PVR (TvHeadend as backend). Could this be related? |
@pejobo are you sure the merge described above is aready in the 15.1 you took? |
No, but the effect of the bug should be visible in 15.0 too, shouldn't it? It crashed every time with 15.1 right after upgrading. Even with fresh (empty) settings directory when enabling pvr. The problem disappeared after going back to 15.0. |
Sorry, forgot to answer your questions. Precompiled kodi from arch repository and self compiled tvh plugin. I also recompiled version for the pvr plugin to rule out incompatibilities. |
I have 2 devices running kodi, one is 15.0 and it runs without any problems. So it seems that the problem is new in the 15.1 (and was not present in 15.0) |
@mapfau So you compiled with this fix here and it fixed your issue with 15.1? |
@pejobo totally right, this fix here was only for 15.1, there was no need to fix anything in 15.0. |
Will the fix then be included in 15.2? It's a severe regression.. |
I am going to revert this. Triggering Persist on a system that os configured not to use DB makes no sense. |
I'm good with everything - the fix here speeds up db in my case (because EPG was pulled in a defined order) and it works without crash (wich was not the case without this fix). If you find a nother way to sync the both EPG sources together, perfect! |
This change makes things worse if you don't use DB. I don't get the sense behind this? There is only a single line that affects DB users. All the rest is makes non DB usage worse. Please elaborate. |
@@ -341,7 +341,7 @@ bool CPVRChannelGroupInternal::CreateChannelEpgs(bool bForce /* = false */) | |||
|
|||
if (HasChangedChannels()) | |||
{ | |||
g_EpgContainer.PersistTables(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
On Kodi startup two threads (1: client -> db, 2: db -> EpgContainer) accessing the same database. 1 is checking for new epg entries, 2 is retrieving valid epg's -> crash.
This first approach locks the dbaccess in PersistXXX functions, wich runs but could lead to freezes in the gui when reading Epg's (Timeline window).
So there must be a better solution for this - this PR is just to not forget the issue, it is an major ticket as kodi don't startup anymore after epg db is filled,
Workaround: "Don't use DB for Epg (in TV::EPG settings dialog)