Opened 9 months ago

Closed 9 months ago

Last modified 5 months ago

#13415 closed Bug Report - Hang/Deadlock (Fixed)

DVBChannel hangs during Close() and Open() due to corruption of is_open

Reported by: simonhyde Owned by: Klaas de Waal
Priority: minor Milestone: 30.1
Component: MythTV - DVB Version: v30-fixes
Severity: medium Keywords: DVB
Cc: Ticket locked: no

Description

When allowing multiple simultaneous recordings on a single tuner in DVB mode and having multiple recordings ending at the same time, mythbackend can hang.

This is because the is_open map of the "master" tuner is modified from multiple threads simultaneously. This can cause the underlying RB tree inside the QMap to get corrupted, such that the next time is_open is accessed (by DVBChannel::Open or DVBChannel::Close, for example) QMap gets stuck in an infinite loop.

Extending the hw_lock to cover is_open cures this, and I've submitted 2 pull requests on github to cover it

Against fixes/29: https://github.com/MythTV/mythtv/pull/179

And ported forward to master: https://github.com/MythTV/mythtv/pull/178

I have only built/tested the version against fixes/29, but I see no reason the fix wouldn't work on master too.

Change History (6)

comment:1 Changed 9 months ago by Klaas de Waal

Owner: set to Klaas de Waal
Status: newassigned

comment:2 Changed 9 months ago by Klaas de Waal

Keywords: DVB added
Milestone: needs_triage31.0
Resolution: Fixed
Status: assignedclosed
Version: UnspecifiedMaster Head

comment:3 Changed 9 months ago by Klaas de Waal

Patch 178 committed to master after testing. No commit done for 30.

comment:4 Changed 6 months ago by Klaas de Waal

Milestone: 31.030.1
Version: Master Headv30-fixes

comment:5 Changed 6 months ago by Klaas de Waal

Backported to v30-fixes on 30 May 2019, 10:28 (7 days ago).

Branch: refs/heads/fixes/30
  Home:   https://github.com/MythTV/mythtv
  Commit: 57ffe65dbc1a80b0f4289f7c6a2b8f2e73e2cf51
      https://github.com/MythTV/mythtv/commit/57ffe65dbc1a80b0f4289f7c6a2b8f2e73e2cf51
  Author: Simon Hyde <simon@icedrop.net>
  Date:   2019-05-30 (Thu, 30 May 2019)

  Changed paths:
    M mythtv/libs/libmythtv/recorders/dvbchannel.cpp

  Log Message:
  -----------
  Prevent data corruption in dvbchannel.cpp causing hang

m_is_open was being corrupted by multiple simultaneous modifications,
leading to it managing to create infinite loops within its underlying
data structure. This patch extends the locking of m_hw_lock to cover
all uses of m_is_open, preventing issues.


  Commit: 6bd8cd499382fd8b132218274fb4ae326c2b0243
      https://github.com/MythTV/mythtv/commit/6bd8cd499382fd8b132218274fb4ae326c2b0243
  Author: Klaas de Waal <klaas@modu.home.lan>
  Date:   2019-05-30 (Thu, 30 May 2019)

  Changed paths:
    M mythtv/libs/libmythtv/recorders/dvbchannel.cpp

  Log Message:
  -----------
  Remove m_ in class member names for backport to fixes-30

comment:6 Changed 5 months ago by Klaas de Waal <klaas@…>

In 6bd8cd4993/mythtv:

Remove m_ in class member names for backport to fixes-30

Refs #13415

Note: See TracTickets for help on using tickets.