segmentation fault when changing device

Bug #486838 reported by Alfredo Pironti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Me TV
Fix Released
Medium
Unassigned
1.1
Fix Released
Medium
Unassigned

Bug Description

I have a computer with two DVB tuners installed: adapter0 is a DVB-S card, adapter1 is a DVB-T card.

By default, me-tv starts using adapter0. Since I would like to use adapter1, I go to the view--> Devices menu, select adapter1, and click OK. At that point the program crashes with a segmentation fault. Using the "--verbose" option, the program outputs the following before crashing:

11/22/2009 23:00:16: Handler: void on_devices(GtkObject*, void*)
11/22/2009 23:00:24: Closing frontend device: /dev/dvb/adapter0/frontend0
11/22/2009 23:00:24: Opening frontend device: /dev/dvb/adapter1/frontend0
11/22/2009 23:00:24: Using 'DiBcom 7000PC' (/dev/dvb/adapter1/frontend0)
Segmentation fault

Starting the program using adapter1 as default device works correctly. So the problem is in switching the device, not in handling adapter1 itself.

If there's anything I can do more, please let me know.

Regards,
Alfredo

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

This needs a backtrace, https://wiki.ubuntu.com/Backtrace (Generation section only).

Changed in me-tv:
status: New → Incomplete
Revision history for this message
Alfredo Pironti (alfredo.pironti) wrote :

Hi,
attached please find a (incomplete?) debug information. The problem actually occurs when the SIGPIPE is emitted.

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

Hi Alfredo,

Well done on getting that far. Unfortunately, the SIGPIPE is a normal part of Me TV operation. You will need to "continue" past that to reproduce the condition that causes the SIGSEGV.

BTW, I committed a change to the 1.1 branch last night that might fix this. It would be great if you could test it. This might help, https://answers.launchpad.net/me-tv/+faq/352.

Cheers,

Michael

Changed in me-tv:
importance: Undecided → Medium
Revision history for this message
Alfredo Pironti (alfredo.pironti) wrote :

Unfortunately, I tried with the latest version from the 1.1 branch (got with the 'bzr branch lp:me-tv me-tv' command), and I always get the same behavior.

I could not "continue" pasting the gdb output because, when I click on "OK" in me-tv (see first post)
- when gdb is not running, I get the segmentation fault
- when gdb is running, the program freezes, and not even hitting Ctrl-C in gdb stops/resumes it (as expected according to the Ubuntu docs). I have to close it from the GNOME interface, clicking the "Force quit" button (same as kill -9?).

Any other way I can add useful info? I guess you can reproduce the bug by having to cards installed on a computer.

Take care,
Alfredo

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

I don't have 2 cards :(

If you know anything about code then you could add a few printf() or g_debug() statements to see which line it's crashing on. It's really not that hard.

Revision history for this message
Alfredo Pironti (alfredo.pironti) wrote :

OK, I'll give the debug-by-printf a try! (But only in the evening, since it's my home computer, and I don't have this setup at work either).

I didn't look at the code yet, but any hint about which file to start from?

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

Jump onto #me-tv if you want to run through this sometime. I'm not always on but if you catch me then we can walk through it.

Revision history for this message
Alfredo Pironti (alfredo.pironti) wrote :

Hi,

I believe I identified the cause of the bug. It actually happens in stream_thread.cc, line 49, probably because a NULL channel is passed as argument. The stack-trace is (read it up-to-bottom)
devices_dialog.cc, line 96
application.cc, line 622

Also note that I have no channels for any device (I don't want to use device 0, so first I need to switch to device 1, then loading some channels). So the problem seems that you are assuming that some "previous" channel on the old device is always selected -- and you are using it on the new device. Also, you start the stream when a new device is selected, is this the real intended behavior?

Regards,
Alfredo

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

Fantastic work. Your are correct in all aspects. You have indeed spotted the cause of the crash and Me TV should not assume that the old channel is available when switching devices. I will fix this today by applying several little fixes for some poor assumptions in Me TV. There are several places where this error could've been stopped but I missed them all :)

Changed in me-tv:
status: Incomplete → In Progress
assignee: nobody → Michael Lamothe (lamothe)
Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

This is not trivial as Me TV is not really set up for multiple device types. I think that I've done the best thing that I can do for now which is to:

1. On startup (and device change) the new channel selected is device type specific and;
2. Application::start_stream() now asserts if the ChannelManager::display_channel is NULL

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

Please note that I have updated the Me TV DB schema as a part of this and Me TV should prompt you to delete your old data and scan again.

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

Please test.

Changed in me-tv:
status: In Progress → Fix Committed
Revision history for this message
Alfredo Pironti (alfredo.pironti) wrote :

Tested: Working!

It asked to clear the old database. Afterwards I was able to successfully switch device.

The only problem I see, is that we should have a channel list for each device, and not a global one (not even one channel list for device type, as I may have a DVB-S on one sat, and another DVB-S on another sat. The same holds for DVB-C with different content providers). But I understand this is quite an intrusive design change... (and if we agree, we should probably open a different bug-report)

Cheers,
Alfredo

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

Great, thanks for testing.

With all due respect, I'm not sure that I agree with having a channel list for each device? For DVB-T guys with dual frontends I think that the channel list should be shared. Well, maybe I see your point but yes, it will require a more complex model to so this.

For the number of people that will use it this way I doubt it's worth the effort. Me TV is designed so that grandma can use it, I doubt that she has a multi device type setup ... could be wrong though ;)

However, I do think that we could limit the channels in the EPG to only those that are valid for the currently selected device. What do you think?

Revision history for this message
Alfredo Pironti (alfredo.pironti) wrote :

If the valid channels for each device are disjoint sets, then this coincides with my proposed solution.

Re "grandma" using several devices. Imagine she buys two set-top-boxes (STB), it is perfectly fine that each STB has its own configuration (and even its own remote). So the grandma approach would suggest that you keep each device separated. Of course, desktop programmes can improve this redundant setup. But it is not clear to me yet how to handle it cleanly.

I agree that the dual DVB-T setup calls for shared channels (and EPG). On the other hand, dual DVB-{S,C} or mixed DVB-* setups may call for different approaches. I suggest you open a blueprint for this, as it seems to me a relevant design matter, not yet fully addressed.

Finally (and this is off-topic, maybe a suggestion for another blueprint), channel reordering dialog is not-convenient when you have hundreds of channels available (as it is for DVB-T in Italy). Imagine reordering channels 103, 109, 145 to channels 1,2,3. You have to drag-n-drop for minutes before you get to the final result. Maybe the possibility to directly input the channel number would help. Also note that many countries (e.g. Italy, UK) support LCN (Logical Channel Numbering), where the broadcasting companies tell you which channel you should assign. (For example, MythTV supports LCN, and it is quite handy, even if channel conflicts are very poorly handled).

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

I don't think that they are blueprints for me to raise. I don't need them and don't plan on implementing them but all are welcome to open up a text editor and fix/improve something. That's why it's FOSS :)

Revision history for this message
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote :

Released in Me TV 1.0.1

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.