[mythtv] Crash in ~DVBChannel()

Roger James roger at beardandsandals.co.uk
Mon May 15 17:14:55 UTC 2017


On 15 May 2017 5:48:58 pm Roger James <roger at beardandsandals.co.uk> wrote:

> I recently put an old tt budget DVB-S card into my main system to do some
> testing. This system already a quad tuner dvb-t card in it. Adding the new
> card meant I immediately ran into persistent naming problems. I fixed this
> in udev and edited the capture cards in myth to use the new names. Part of
> this edit involved changing the driver type on one of the existing card
> definitions from dvb-t to dvb-s, and of course changing the device names on
> all the entries. This all looked great in mythtv-setup 5 capture cards 1
> satellite and 4 terrestrial. However I had neglected to look at the second
> page of the card details in the edit pages.
>
> What I had actually ended up with in the database was.
>
> 2 entries pointing at my mono  DVB-S card set up as parent and child, 2
> entries pointing to tuner 1 on my quad card, 2 entries pointing at tuner 2,
> 1 pointing at tuner 3 and 1 pointing at tuner 4.
>
> I fixed the crash by setting the concurrent recordings stuff back to 1.
>
>
> But I think are more robust fix is needed.
>
>
> The current code looks like this. It crashes because either the map does
> not contain the key or it does but the list for that key is empty.
>
>
> DVBChannel::~DVBChannel()
> {
> // set a new master if there are other instances and we're the master
> // whether we are the master or not remove us from the map.
> master_map_lock.lockForWrite();
>
> QString key = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, device);
>
> if (m_pParent)
>     key += QString(":%1") .arg(CardUtil::GetSourceID(m_pParent->GetInputId()));
>
> DVBChannel *master = static_cast<DVBChannel*>(master_map[key].front());
>
> I stuck some diagnostics in and I got this.
>
> ~DVBChannel(0x61500000cf80)
> ~DVBChannel(0x61500000cf80) key /dev/dvb/adapter_tt1/frontend0
> ~DVBChannel(0x61500000cf80) master_map does not contain key
> /dev/dvb/adapter_tt1/frontend0
> ~DVBChannel(0x61500000cf80) removing all instances of this from master_map
>
> ~DVBChannel(0x61500000cd00)
> ~DVBChannel(0x61500000cd00) key /dev/dvb/adapter_tt1/frontend0
> ~DVBChannel(0x61500000cd00) master_map for /dev/dvb/adapter_tt1/frontend0:0
> is empty
> ~DVBChannel(0x61500000cd00) removing all instances of this from master_map
>
> mythbackend.service: Main process exited, code=dumped, status=11/SEGV
> Stopped MythTV backend service.
> mythbackend.service: Unit entered failed state.
> mythbackend.service: Failed with result 'core-dump'.
>
> I had put the line that initially shows just the key a bit too early in the
> function. The actual key is shown in the following lines.
>
> Comments anyone?
>
> Roger
>
>
I forgot to add that I also changed the logic a bit to ensure that master 
was set to NULL if a valid value was not available. That's why the log 
shows it crashing on the second TVrec.

R.





More information about the mythtv-dev mailing list