Opened 7 years ago

Closed 3 years ago

#10629 closed Bug Report - General (Fixed)

mythwelcome not painting, mythshutdown hang

Reported by: Malcolm Parsons <malcolm.parsons@…> Owned by:
Priority: minor Milestone: 0.26
Component: MythTV - Mythwelcome & Mythshutdown Version: 0.25-fixes
Severity: medium Keywords: mythwelcome, hang
Cc: Ticket locked: no

Description

I'm seeing a similar problem to ticket:10032.

At least once a day mythwelcome stops responding and there is a mythshutdown process using 100% CPU.

Attachments (4)

mythshutdown-gdb.txt (1.1 KB) - added by Malcolm Parsons <malcolm.parsons@…> 7 years ago.
mythwelcome-gdb.txt (12.8 KB) - added by Malcolm Parsons <malcolm.parsons@…> 7 years ago.
mythshutdown-drd.txt (124.5 KB) - added by Malcolm Parsons <malcolm.parsons@…> 7 years ago.
mythwelcome.diff (851 bytes) - added by Malcolm Parsons <malcolm.parsons@…> 7 years ago.
Patch to ignore duplicate messages

Download all attachments as: .zip

Change History (13)

Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

Attachment: mythshutdown-gdb.txt added

Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

Attachment: mythwelcome-gdb.txt added

comment:1 Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

valgrind's drd tool finds 60 errors in mythshutdown.

This one has a stacktrace matching the hang:

valgrind --tool=drd /usr/bin/mythshutdown --status 0 --verbose general --loglevel info --syslog local7

...

==8592== Thread 1:
==8592== not a condition variable: cond 0x6cabbd4
==8592==    at 0x402C51F: pthread_cond_destroy@* (drd_pthread_intercepts.c:683)
==8592==    by 0x5412583: pthread_cond_destroy@GLIBC_2.0 (forward.c:102)
==8592==    by 0x5331980: __run_exit_handlers (exit.c:78)
==8592==    by 0x5331A0C: exit (exit.c:100)
==8592==    by 0x531811A: (below main) (libc-start.c:258)

Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

Attachment: mythshutdown-drd.txt added

comment:2 Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

==13947== Conflicting load by thread 2 at 0x04bb7644 size 4
==13947==    at 0x4A5565A: MythDB::getMythDB() (mythdb.cpp:27)
==13947==    by 0x4A556F3: GetMythDB() (mythdb.cpp:48)
==13947==    by 0x4B1C1B3: DBLoggerThread::run() (logging.cpp:550)
==13947==    by 0x4A2BC91: MThreadInternal::run() (mthread.cpp:78)
==13947==    by 0x6CC0D30: start_thread (pthread_create.c:304)
==13947==    by 0x53D246D: clone (clone.S:130)

http://qt-project.org/forums/%20/viewthread/3784#23286

Patch:

diff --git a/mythtv/libs/libmythbase/mythdb.cpp b/mythtv/libs/libmythbase/mythdb.cpp
index ea30783..2e62d96 100644
--- a/mythtv/libs/libmythbase/mythdb.cpp
+++ b/mythtv/libs/libmythbase/mythdb.cpp
@@ -8,6 +8,7 @@ using namespace std;
 #include <QFile>
 #include <QHash>
 #include <QDir>
+#include <QAtomicPointer>
 
 #include "mythdb.h"
 #include "mythdbcon.h"
@@ -16,7 +17,7 @@ using namespace std;
 #include "mythdirs.h"
 #include "mythcorecontext.h"
 
-static MythDB *mythdb = NULL;
+static QAtomicPointer<MythDB> mythdb;
 static QMutex dbLock;
 
 // For thread safety reasons this is not a QString

comment:3 Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

(gdb) disassemble 
Dump of assembler code for function _nv012tls:
   0x07fe6be0 <+0>:	sub    $0xc,%esp
   0x07fe6be3 <+3>:	call   0x7fe69f0 <_nv009tls>
   0x07fe6be8 <+8>:	test   %eax,%eax
   0x07fe6bea <+10>:	je     0x7fe6bfd <_nv012tls+29>
   0x07fe6bec <+12>:	lea    0x0(%esi,%eiz,1),%esi
   0x07fe6bf0 <+16>:	mov    0x4(%eax),%edx
   0x07fe6bf3 <+19>:	test   %edx,%edx
   0x07fe6bf5 <+21>:	jne    0x7fe6c01 <_nv012tls+33>
   0x07fe6bf7 <+23>:	mov    (%eax),%eax
   0x07fe6bf9 <+25>:	test   %eax,%eax
   0x07fe6bfb <+27>:	jne    0x7fe6bf0 <_nv012tls+16>
   0x07fe6bfd <+29>:	add    $0xc,%esp
   0x07fe6c00 <+32>:	ret    
=> 0x07fe6c01 <+33>:	jmp    0x7fe6c01 <_nv012tls+33>
End of assembler dump.

https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers/+bug/821702

comment:4 Changed 7 years ago by George Nassas <gnassas@…>

Further on the nvidia angle I found that setting

__GL_SINGLE_THREADED=1

makes the hanging go away. I got that from:

http://projects.blender.org/tracker/index.php?func=detail&aid=29385&group_id=9&atid=231

which references:

https://bugs.gentoo.org/show_bug.cgi?id=375615

comment:5 Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

__GL_SINGLE_THREADED=1 does workaround the mythshutdown hang, but mythwelcome still doesn't paint.

mythwelcome seems to work OK until it logs this:

Apr 28 17:45:15 mythtv mythwelcome[4253]: N CoreContext mythmainwindow.cpp:2608 (IdleTimeout) Entering standby mode after 30 minutes of inactivity

After that, mythwelcome seems to be processing an endless stream of SHUTDOWN_COUNTDOWN events, each of which causes mythshutdown to be executed.

comment:6 Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

I can't work out why mythbackend sometimes sends lots of SHUTDOWN_COUNTDOWN messages at once, so here's a patch to make mythwelcome ignore the duplicate messages.

Changed 7 years ago by Malcolm Parsons <malcolm.parsons@…>

Attachment: mythwelcome.diff added

Patch to ignore duplicate messages

comment:7 Changed 6 years ago by beirdo

Component: MythTV - GeneralMythTV - Mythwelcome & Mythshutdown

comment:8 Changed 6 years ago by Malcolm Parsons <malcolm.parsons@…>

Fixed by ticket:10279

I'd still like the patch in comment:2 to be applied.

comment:9 Changed 3 years ago by paulh

Milestone: unknown0.26
Resolution: Fixed
Status: newclosed

Reported to be fixed by 88817964d66d

Note: See TracTickets for help on using tickets.