Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11663 closed Bug Report - General (fixed)

cancelling MythDownloadManager can cause a crash

Reported by: JYA Owned by: cpinkham
Priority: critical Milestone: 0.27
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Using Qt compiled in debug mode runs additional test and safety; with plenty of asserts being enabled.

When the HLSRingBuffer has been interrupted and is attempting to cancel a download, it can occasionally crash.

The error being:

    Q_ASSERT_X(currentThread == thr || !thr,
               "QCoreApplication::sendEvent",
               QString::fromLatin1("Cannot send events to objects owned by a different thread. "
                                   "Current thread %1. Receiver '%2' (of type '%3') was created in thread %4")
               .arg(QString::number((quintptr) currentThread, 16))

Attached is the full backtrace, crash is in thread 36, MythDownloadManager::cancelDownload

Attachments (2)

MDMcrash.gdb (71.9 KB) - added by JYA 11 years ago.
crash in thread #36
0001-Ensure-cancelling-a-download-is-done-in-the-same-thr.patch (3.9 KB) - added by JYA 11 years ago.
Fixes for crash

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by JYA

Attachment: MDMcrash.gdb added

crash in thread #36

Changed 11 years ago by JYA

Fixes for crash

comment:1 Changed 11 years ago by Jean-Yves Avenard <jyavenard@…>

Resolution: fixed
Status: newclosed

In 997f7aa10fca9adbe76a7bdf24d4d87398beeaa3/mythtv:

Ensure cancelling a download is done in the same thread it started

This prevent Qt to crash with "Cannot send events to objects owned by a different thread."

Fixes #11663

comment:2 Changed 11 years ago by paulh

Milestone: unknown0.27
Version: UnspecifiedMaster Head

comment:3 Changed 11 years ago by Jean-Yves Avenard <jyavenard@…>

In 229a4267480a59b9a0de02e2d5ad4c9a971b7c9c/mythtv:

Ensure cancelling a download is done in the same thread it started; take #2

MythDownloadManager::cancelDownload() needs to wait for the cancel to actually occur as some code relies on that behaviour.
This includes the same fix as commit eb78c7bda7c1859831997a54a3e3eadbb0993dd7 "Prevent multiple instances of the same DownloadInfo?"

Fixes #11663

comment:4 Changed 11 years ago by Jean-Yves Avenard <jyavenard@…>

In c4960e5e9b2eb84834b455a4ce0dc96fd08fe414/mythtv:

Use a queue to cancel downloads.
cancelDownload can be blocking or not.
Add API to cancel a list of urls.
Hopefully prevent another racing conditions seen with HLS recorder when changing channels quickly.

Fixes #11663

Note: See TracTickets for help on using tickets.