Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 10 months ago

Closed 9 months ago

Last modified 8 months ago

#11663 closed Bug Report - General (fixed)

cancelling MythDownloadManager can cause a crash

Reported by: jyavenard 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 jyavenard 10 months ago.
crash in thread #36
0001-Ensure-cancelling-a-download-is-done-in-the-same-thr.patch (3.9 KB) - added by jyavenard 10 months ago.
Fixes for crash

Download all attachments as: .zip

Change History (6)

Changed 10 months ago by jyavenard

crash in thread #36

Changed 10 months ago by jyavenard

Fixes for crash

comment:1 Changed 9 months ago by Jean-Yves Avenard <jyavenard@…>

  • Resolution set to fixed
  • Status changed from new to closed

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 9 months ago by paulh

  • Milestone changed from unknown to 0.27
  • Version changed from Unspecified to Master Head

comment:3 Changed 8 months 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 8 months 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

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.