Kodi Community Forum
New MythTV add-on using libcmyth - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: New MythTV add-on using libcmyth (/showthread.php?tid=110694)



RE: New MythTV add-on using libcmyth - pgjensen - 2013-02-08

PSA: Anyone building the Win32 dll from source, if you get an error when loading it in XBMC like "Add-on could not be loaded. An unknown error has occurred" then it's because you don't have the same runtime environment installed (i.e. vcredist) that it was compiled with. I compiled with Visual Studio 2012 and had to install the 2012 sp1 runtime environment on the XBMC machines to get it working.

I believe there's a Preference on the project level to point it to an older runtime, but I didn't go down that route.

Anyways, hopefully this helps as I couldn't find any answers in the thread about it.


RE: New MythTV add-on using libcmyth - watskooo - 2013-02-08

(2013-02-02, 15:01)richardk Wrote: I'm seeing -- and another user has also reported -- one more anomaly that may be related to this add-on.

The longer my MythTV system is up, the more cpu time the mythbackend process uses when a remote XBMC system is playing a video. Eventually, the cpu load becomes so high that we get stuttering. A reboot of the MythTV box always fixes the problem, but only temporarily.

I performed a little experiment. I started up an ssh session to my MythTV box, and ran top so that I could monitor cpu usage for the mythbackend process.

On my frontend machine (Acer AspireRevo 1600 running Ubuntu) I started Mythfrontend and played an episode of a program recorded at 1080i. Checking the MythTV system, the mythbackend process' cpu load was hovering around 20%.

Next, I closed Mythfrontend and started XBMC on the same machine under Ubuntu. I used it to play the exact same episode. Now mythbackend was consuming about 50% cpu time consistently.

Clearly, there's something different about how XBMC interacts with the MythTV backend system. Since non-XBMC MythTV users don't seem to be reporting problems with excessive cpu load with Mythbackend, I wonder if XBMC or the cmyth plugin are somehow triggering the problem.

I've seen the same behavior using Openelec 3 RC2 and mythtv .24. Restarting the xbmc/openelec box doesn't help, but restarting the mythtv-backend process always fixes it. The CPU usage of mythtv-backend keeps increasing until the front end is unusable.


RE: New MythTV add-on using libcmyth - richardk - 2013-02-08

(2013-02-08, 21:21)watskooo Wrote: I've seen the same behavior using Openelec 3 RC2 and mythtv .24. Restarting the xbmc/openelec box doesn't help, but restarting the mythtv-backend process always fixes it. The CPU usage of mythtv-backend keeps increasing until the front end is unusable.

Yes, that's what I'm seeing. Interesting that this also happens on MythTV 0.24. I'm running 0.26 under Ubuntu 12.10.




RE: New MythTV add-on using libcmyth - martyg7 - 2013-02-09

Same issue here with mythbackend CPU load creeping away with OpenElec frontend.
Restarting the backend fixes the problem. I need to do it every day or so.
I do not see this if I leave OpenElec PVR function off and use my desktop frontend.
Backend is 0.26 on Debian Wheezy, kept up to date with deb-multimedia repo.
This is a day-one issue for me. First noticed this in November.


RE: New MythTV add-on using libcmyth - richardk - 2013-02-09

(2013-02-09, 00:39)martyg7 Wrote: Same issue here with mythbackend CPU load creeping away with OpenElec frontend.
Restarting the backend fixes the problem. I need to do it every day or so.
I do not see this if I leave OpenElec PVR function off and use my desktop frontend.
Backend is 0.26 on Debian Wheezy, kept up to date with deb-multimedia repo.
This is a day-one issue for me. First noticed this in November.

Just performed another experiment. My MythTV box had been up for 5 days 14 hours. I played the same recorded HD content and watched the cpu load on the MythTV box:

Using XBMC on OpenELEC ION x64 (Acer AspireRevo 1600): 40% -50% cpu load for mythbackend

XBMC on Ubuntu 12.10 (Acer AspireRevo 1600): 40% -50% load

XBMC on OpenELEC ION x64 after rebooting: 3% -4% load



RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-09

Of cause this is something we need to resolve. But I didn't see this on my backend.
Thanks for your efforts so far! It would be nice if you could answer a few questions (as detailed as possible), so that I get an idea of where to start looking.

- Is your backend always running or does it go to standby?
- Is your xbmc frontend always running? Do you shutdown xbmc or does it go to standby?
- Does memory usage increase over time?
- How about idle loads? From what I understood, idle is always good, you only see the difference when starting playback.
- Does the cpu usage increase over time or does the number of playback starts/stops matter? If you start and stop plenty of recordings can you reproduce it then within a couple of minutes?
- Anything suspicious in the backend/xbmc logs?

Thanks! Christian


RE: New MythTV add-on using libcmyth - martyg - 2013-02-09

@cftezer

See my earlier post for configutation.
Backend and frontend are running 24/7. Standy is disabled.

Backend is stable, but RPi freezes up frequently when cMyth is enabled, which I correct with Rpi restart.
(I see load averages 7+, IO CPU% pegged, XMBC process starved out, free memory ~8MB after freeze, normal is 10-12MB)
I have seen this behavior on OpenELEC and RaspBMC - Only when cMyth plugin is enabled.

I cannot see nay obvious memory leaks on the frontend side.

Observed Idle/running loads on backend for me are 1%/10% when good, 10%/60% once backend needs a restart.
This slowly increases over time. I can usually go a whole evening before having to restart the backend.

I think the Myth backend runaway is a side effect of the frontend constantly dropping out, and the backend not cleaning up.

Nothing obvious to report from the logs.

Thanks for looking at this annoying problem. Best regards.


RE: New MythTV add-on using libcmyth - richardk - 2013-02-09

(2013-02-09, 10:44)cfetzer Wrote: Of cause this is something we need to resolve. But I didn't see this on my backend.
Thanks for your efforts so far! It would be nice if you could answer a few questions (as detailed as possible), so that I get an idea of where to start looking.

- Is your backend always running or does it go to standby?
- Is your xbmc frontend always running? Do you shutdown xbmc or does it go to standby?
- Does memory usage increase over time?
- How about idle loads? From what I understood, idle is always good, you only see the difference when starting playback.
- Does the cpu usage increase over time or does the number of playback starts/stops matter? If you start and stop plenty of recordings can you reproduce it then within a couple of minutes?
- Anything suspicious in the backend/xbmc logs?

Thanks! Christian

My backend is always running. It does not go to standby. Same for the XBMC frontends.

Over time, while playing recorded videos, "free" memory decreases and "cached" memory increases until "free" reaches about 128MB. I understand that this is normal.

Idles loads seem fine. If the MythTV system has been running a long time, cpu loads are high when the PVR addon starts up, as well as during playback.

I wasn't able to reproduce the problem by doing repeated starts and stops of recordings (about 20) after a boot of the MythTV backend.

I'm seeing a lot of these in the logs:

Code:
Feb  6 20:26:48 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1512 (HandleAnnounce) adding: openelec as a remote file transfer
Feb  6 20:26:48 MythTV mythlogserver: mythbackend[16789]: E ProcessRequest fileringbuffer.cpp:285 (OpenFile) FileRingBuf(/storage/recordings/2411_20130207020000.mpg.png): OpenFile(): Could not open.
Feb  6 20:26:48 MythTV mythlogserver: mythbackend[16789]: E ProcessRequest fileringbuffer.cpp:285 (OpenFile) FileRingBuf(/storage/recordings/2411_20130207020000.mpg.png): OpenFile(): Could not open.
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1510 (HandleAnnounce) MainServer::HandleAnnounce FileTransfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1512 (HandleAnnounce) adding: RICHARD as a remote file transfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: E ProcessRequest fileringbuffer.cpp:285 (OpenFile) FileRingBuf(/storage2/recordings/2191_20130207020000.mpg.png): OpenFile(): Could not open.
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1510 (HandleAnnounce) MainServer::HandleAnnounce FileTransfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1512 (HandleAnnounce) adding: RICHARD as a remote file transfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1510 (HandleAnnounce) MainServer::HandleAnnounce FileTransfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1512 (HandleAnnounce) adding: openelec as a remote file transfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: E ProcessRequest fileringbuffer.cpp:285 (OpenFile) FileRingBuf(/storage/recordings/2411_20130207020000.mpg.png): OpenFile(): Could not open.
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: E ProcessRequest fileringbuffer.cpp:285 (OpenFile) FileRingBuf(/storage2/recordings/2191_20130207020000.mpg.png): OpenFile(): Could not open.
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1510 (HandleAnnounce) MainServer::HandleAnnounce FileTransfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1512 (HandleAnnounce) adding: openelec as a remote file transfer
Feb  6 20:26:58 MythTV mythlogserver: mythbackend[16789]: E ProcessRequest fileringbuffer.cpp:285 (OpenFile) FileRingBuf(/storage/recordings/2411_20130207020000.mpg.png): OpenFile(): Could not open.
Feb  6 20:27:08 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1510 (HandleAnnounce) MainServer::HandleAnnounce FileTransfer
Feb  6 20:27:08 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1512 (HandleAnnounce) adding: RICHARD as a remote file transfer
Feb  6 20:27:08 MythTV mythlogserver: mythbackend[16789]: E ProcessRequest fileringbuffer.cpp:285 (OpenFile) FileRingBuf(/storage2/recordings/2191_20130207020000.mpg.png): OpenFile(): Could not open.
Feb  6 20:27:08 MythTV mythlogserver: mythbackend[16789]: I ProcessRequest mainserver.cpp:1510 (HandleAnnounce) MainServer::HandleAnnounce FileTransfer

Unlike martyg, my OpenELEC frontends are not freezing. So I don't think that repeated disconnects and connects are causing the problem for me.


RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-09

We need to identify the component that causes this. If the frontend<->backend connections are up all the time, then reconnecting is ok.
Next suspect would be image caching.

Since I cannot reproduce this, I'd need your help. Could you please compile my branch "debug-backend-cpu"
and try that? I disabled image support in there. Let me know if that makes any difference.

(https://github.com/fetzerch/xbmc-pvr-addons/archive/debug-backend-cpu.zip )

One more interesting thing is: How many recordings do you currently have and how often do you record?

Thanks, Christian


RE: New MythTV add-on using libcmyth - richardk - 2013-02-09

(2013-02-09, 19:59)cfetzer Wrote: We need to identify the component that causes this. If the frontend<->backend connections are up all the time, then reconnecting is ok.
Next suspect would be image caching.

Since I cannot reproduce this, I'd need your help. Could you please compile my branch "debug-backend-cpu"
and try that? I disabled image support in there. Let me know if that makes any difference.

(https://github.com/fetzerch/xbmc-pvr-addons/archive/debug-backend-cpu.zip )

One more interesting thing is: How many recordings do you currently have and how often do you record?

Thanks, Christian

Thanks! I'll compile your debug version and try it. However, it could be several days before I know for sure if the problem is solved.

I have a lot of recordings -- about 1200. I record about 5-10 per day. Old recordings are deleted to make room for new ones.


RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-09

Great, thanks. I know it takes time. This version is still fully functional (it just has no images). Sorry for the inconvenience.


RE: New MythTV add-on using libcmyth - richardk - 2013-02-09

(2013-02-09, 20:20)cfetzer Wrote: Great, thanks. I know it takes time. This version is still fully functional (it just has no images). Sorry for the inconvenience.

Thanks for the response on this! I'm not worried about the images. I don't find them very useful anyway.




RE: New MythTV add-on using libcmyth - simora - 2013-02-09

@cfetzer

I built the latest master (1.6.9 now) still same issue. Any ideas on what the issue could be?


RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-09

(2013-02-09, 21:00)simora Wrote: @cfetzer

I built the latest master (1.6.9 now) still same issue. Any ideas on what the issue could be?

Ah sorry, almost forgot about this. Well, it says "cannot open shared object file: No such file or directory" and this is usually trustworthy.
I don't know how xbmc's addon packaging works and why it does not work on your arm box.
But I still believe it should work to manually install by copying the files (especially the .pvr file) to the folder where xbmc expects it.
Could be also a permission problem, so make sure it's readable by xbmc's process.

strace (http://linux.die.net/man/1/strace ) is a good tool to see what files a process tries to read and why exactly this fails.

Start xbmc, run:
Code:
strace -p `pidof xbmc.bin` -o /tmp/xbmc.strace.log
and then try to install and activate the addon.


RE: New MythTV add-on using libcmyth - simora - 2013-02-09

The image for this box does not have strace or a build environment in it. I need to build a new image with strace in it. This will take some time. I'll get back to you when I have it all built and strace run. Thank you for helping me out on this.