Bug 6896 - me-tv unusable due to insane i/o load [PATCH]
Summary: me-tv unusable due to insane i/o load [PATCH]
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 2
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL: https://bugs.launchpad.net/me-tv/+bug...
Whiteboard: has_procedure MGA2-64-OK MGA2-32-OK
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2012-07-29 01:33 CEST by Christian Lohmaier
Modified: 2012-09-13 19:50 CEST (History)
4 users (show)

See Also:
Source RPM: me-tv-1.3.6-4.mga2.src.rpm
CVE:
Status comment:


Attachments
patch making me-tv behave sanely. (993 bytes, patch)
2012-07-29 01:33 CEST, Christian Lohmaier
Details | Diff

Description Christian Lohmaier 2012-07-29 01:33:02 CEST
Created attachment 2589 [details]
patch making me-tv behave sanely.

The way me-tv uses the sqldatabase for the epg events causes insane amount of i/o, rendering not only the UI of me-tv completely unresponsive, but also has a huge impact on overall system performance.

Applying the patch from the ubuntu-bug solves the problem.

Adapted to apply & attached for your convenience.

+ Patch1:         me-tv-sqlite-fix.patch
[...]
+ %patch1 -b .fix-sqlite
Manuel Hiebel 2012-07-29 16:03:54 CEST

Keywords: (none) => PATCH
Assignee: bugsquad => doktor5000

Comment 1 Florian Hubold 2012-07-29 20:14:57 CEST
Nice one, so this is the cause for the UI freezes. I thought it was about oxygen-gtk problems, as only the UI froze, but the video continued. Will test and apply. Greatly appreciated :)

Status: NEW => ASSIGNED
CC: (none) => doktor5000

Comment 2 Florian Hubold 2012-08-05 11:02:53 CEST
FWIW, how did you measure the high i/o load? Via top or iotop or something different? As for me, it doesn't make much differences with or without the patch, but it could be that it depends on how the DVB receiver handles EPG data. For me me-tv also doesn't freeze, just checked with a Hauppauge NovaT 500 (usb id 2040:5200) with the patch and without.
Comment 3 Christian Lohmaier 2012-08-06 13:19:42 CEST
> FWIW, how did you measure the high i/o load?

Via iotop - but the high load is apparent by lack of responsiveness, and also by the hdd-activity led ;-)
The amount of data it writes isn't that bug, but the journal job is at it limits.
([jbd2/sda6-8])

It is most apparent when you don't have epg-data yet or your epg data is really outdated, as the incremental updates only causes spikes for a couple of seconds, and as playback of the current channel isn't affected, you won't notice any problem when just watching TV.

So to reproduce: 

1) Check that your mount options actually include the barrier option, as the problem only is visible with that one activated:

$ mount | grep home
/dev/sda6 on /home type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)

(this is a default when installing Mageia2, but when you did upgrade it might have different options)

2) move me-tv's database away to force writing all epg anew
mv ~/.local/share/me-tv ~/.local/share/me-tv_old

3) launch unpatched me-tv, add some channels and tune to a channel for watching,
then wait for the EPG-database-writing thread to kick in

When it kicks in
* me-tv is unresponsive. You cannot open any menu, you cannot switch channels (the currently tuned channel continues to display just fine)
* in iotop you can see the i/o of the journaling/partition job to be at >>90%
* your hdd-activity led should be lit all the time

The epg-writing finishes eventually and me-tv is responsive again, but you can still see the I/O spikes when writing updated EPG, although the timespan it blocks then is (much) shorter for the incremental updates.

Now do the same with the patched version.
1) remove existing ~/.local/share/me-tv
2) start patched me-tv, configure channels, tune to a channel, wait for EPG-writing thread

Now me-tv won't block, and writing epg will be so fast, you'll have a hard time spotting it in iotop.

For sake of completeness (although I don't see how the device could have an impact on writing epg-data):

I'm using a 

LogiLink VG0002A (a USB-dongle with RTL2832 chip with FC0013 Tuner)

with the (modified to compile on recent kernels) driver from Realtek from here: https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0
Comment 4 Florian Hubold 2012-08-12 10:47:21 CEST
There is now me-tv-1.3.6-4.1.mga2 in core/updates_testing to validate
-------------------------------------------------------


Suggested advisory:
-------------------
This update addresses the following issue:

- The way me-tv uses the sqldatabase for the EPG events causes insane amount of
i/o, rendering not only the UI of me-tv completely unresponsive, but also has a
huge impact on overall system performance. A patch from Ubuntu was added to fix these issue.

Thanks to Christian Lohmaier for the bug report, the link to the patch and extensive instructions to verify the I/O load problem.

-------------------------------------------------------
Steps to reproduce:

- install/update to update candidate
1) Check that your mount options actually include the barrier option, as the
problem only is visible with that one activated:

$ mount | grep home
/dev/sda6 on /home type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)

(this is a default when installing Mageia2, but when you did upgrade it might
have different options)

2) move me-tv's database away to force writing all epg anew
mv ~/.local/share/me-tv ~/.local/share/me-tv_old

3) launch unpatched me-tv, add some channels and tune to a channel for
watching,
then wait for the EPG-database-writing thread to kick in

When it kicks in
* me-tv is unresponsive. You cannot open any menu, you cannot switch channels
(the currently tuned channel continues to display just fine)
* in iotop you can see the i/o of the journaling/partition job to be at >>90%
* your hdd-activity led should be lit all the time

The epg-writing finishes eventually and me-tv is responsive again, but you can
still see the I/O spikes when writing updated EPG, although the timespan it
blocks then is (much) shorter for the incremental updates.

Keywords: PATCH => (none)
Hardware: x86_64 => All
Assignee: doktor5000 => qa-bugs

Samuel Verschelde 2012-08-13 12:49:36 CEST

CC: (none) => stormi
Whiteboard: (none) => has_procedure

Comment 5 Samuel Verschelde 2012-08-20 11:40:59 CEST
The procedure doesn't tell it, but I guess you need a DVB device to test me-tv. 

Christian, Florian, maybe you could test on Mageia 2 i586 and x86_64 since you own such devices?
Comment 6 Florian Hubold 2012-08-20 21:37:15 CEST
Well, own - technically no :)
Will try to test when i get my hands on it again, probably at the weekend or so.
Comment 7 Christian Lohmaier 2012-08-28 22:32:06 CEST
I confirm that the patch works on x86_64

(and yes, without dvb-device, me-tv cannot receive any epg data to write. DVB-T dongles are quite affordable now (you get them for less than 15â¬) and much more comfortable than analog HDD/DVD recorder :-)
Comment 8 Samuel Verschelde 2012-08-28 22:48:57 CEST
Thanks, now one tester for i586 (can be you too if you can test from a LiveCD for example), and the update will be validated.

Whiteboard: has_procedure => has_procedure MGA2-64-OK

Comment 9 claire robinson 2012-09-12 10:32:36 CEST
I'll send a request to mageia-discuss this morning
Comment 10 Manuel Hiebel 2012-09-12 18:31:29 CEST
On an mageia 2 i586 with updates installed today and a noname dvb card (dvb-usb-ec168 firmware)

The me-tv update fix great the bug.

Updates validating


Suggested Advisory:
-------------
This update addresses the following issue:

- The way me-tv uses the sqldatabase for the EPG events causes insane amount of
i/o, rendering not only the UI of me-tv completely unresponsive, but also has a
huge impact on overall system performance. A patch from Ubuntu was added to fix
these issue.

Thanks to Christian Lohmaier for the bug report, the link to the patch and
extensive instructions to verify the I/O load problem.

-------------

SRPM: me-tv-1.3.6-4.1.mga2.src.rpm

Could sysadmin please push from core/updates_testing to core/updates

Thankyou!

Keywords: (none) => validated_update
CC: (none) => sysadmin-bugs
Whiteboard: has_procedure MGA2-64-OK => has_procedure MGA2-64-OK MGA2-32-OK

Comment 11 Thomas Backlund 2012-09-13 19:50:47 CEST
Update pushed:
https://wiki.mageia.org/en/Support/Advisories/MGAA-2012-0191

Status: ASSIGNED => RESOLVED
CC: (none) => tmb
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.