Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#12754 closed Bug Report - Hang/Deadlock (fixed)

deadlock at startup with CEC enabled

Reported by: bbaetz@… Owned by: Stuart Auchterlonie
Priority: minor Milestone: 0.28.1
Component: MythTV - General Version: 0.28.0
Severity: medium Keywords: patch
Cc: Ticket locked: no

Description

Configuring the TV at startup is done from the main thread. However, when the TV state changes as a result of this, libCEC sends a message to the callback handler on its own thread, which tries to get the UI lock to reset the screensaver state. This results in a deadlock because the main thread already has the UI lock during startup time.

Instead, run the initial setup activity at the start of the CEC handler thread.

This was missed in the patch applied for #11986 when I did a merge - I've been running this on my 0.27 system for > 1 year.

Attachments (2)

libcec2-deadlock-fix.patch (1.1 KB) - added by bbaetz@… 4 years ago.
patch
libcec2-deadlock-fix.v3.patch (1.9 KB) - added by Bradley Baetz <bbaetz@…> 3 years ago.
Patch against latest fixes/0.28

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by bbaetz@…

Attachment: libcec2-deadlock-fix.patch added

patch

comment:1 Changed 4 years ago by Stuart Auchterlonie

Milestone: unknown0.28.1
Version: Unspecified0.28.0

Changed 3 years ago by Bradley Baetz <bbaetz@…>

Patch against latest fixes/0.28

comment:2 Changed 3 years ago by Bradley Baetz <bbaetz@…>

I've attached a patch against fixes/0.28. I've been running with this for over a year (since it was missed in my upload for #11986) - can this please be applied?

comment:3 Changed 3 years ago by Stuart Auchterlonie

Owner: set to Stuart Auchterlonie
Status: newaccepted

comment:4 Changed 3 years ago by Bradley Baetz <bbaetz@…>

Resolution: fixed
Status: acceptedclosed

In 22ff48d7bafc622246141094b727dab47662bc3f/mythtv:

Fixes #12754 - Fix deadlock in libcec initialization.

Configuring the TV at startup is done from the main thread. However, when the
TV state changes as a result of this, libCEC sends a message to the callback
handler on its own thread, which tries to get the UI lock to reset the
screensaver state. This results in a deadlock because the main thread already
has the UI lock during startup time.

Instead, run the initial setup activity at the start of the CEC handler thread.

This was missed in the patch applied for #11986.

Signed-off-by: Stuart Auchterlonie <stuarta@…>

comment:5 Changed 3 years ago by Bradley Baetz <bbaetz@…>

In 2d6466f1aa08c29531f27edd61963d5180186a96/mythtv:

Fixes #12754 - Fix deadlock in libcec initialization.

Configuring the TV at startup is done from the main thread. However, when the
TV state changes as a result of this, libCEC sends a message to the callback
handler on its own thread, which tries to get the UI lock to reset the
screensaver state. This results in a deadlock because the main thread already
has the UI lock during startup time.

Instead, run the initial setup activity at the start of the CEC handler thread.

This was missed in the patch applied for #11986.

Signed-off-by: Stuart Auchterlonie <stuarta@…>
(cherry picked from commit 22ff48d7bafc622246141094b727dab47662bc3f)

Note: See TracTickets for help on using tickets.