[mythtv] Ticket #9745: Mythbackend deadlock with slave backend connected

Bruce Taber b.taber at comcast.net
Mon Apr 25 21:34:18 UTC 2011


On 04/25/2011 02:10 PM, Douglas Paul wrote:
> On Fri, Apr 22, 2011 at 04:22:56PM -0400, Tom Lichti wrote:
>> As I mentioned in the ticket, and in the -users thread, I have applied
>> that change and it still deadlocks consistently. Gavin asked that I
>> try it, and if it still didn't work, to open a new ticket, which I
>> did.
> 
> I ran into something like this issue as well, and the following patch fixes
> it for me:
> 
> diff --git a/mythtv/programs/mythbackend/autoexpire.cpp b/mythtv/programs/mythbackend/autoexpire.cpp
> index 04fb8b3..d65c356 100644
> --- a/mythtv/programs/mythbackend/autoexpire.cpp
> +++ b/mythtv/programs/mythbackend/autoexpire.cpp
> @@ -76,7 +76,8 @@ AutoExpire::AutoExpire(QMap<int, EncoderLink *> *tvList) :
>      desired_freq(15),
>      expire_thread_run(true),
>      main_server(NULL),
> -    update_pending(false)
> +    update_pending(false),
> +    update_thread(NULL)
>  {
>      expire_thread->start();
>      gCoreContext->addListener(this);
> @@ -91,7 +92,8 @@ AutoExpire::AutoExpire() :
>      desired_freq(15),
>      expire_thread_run(false),
>      main_server(NULL),
> -    update_pending(false)
> +    update_pending(false),
> +    update_thread(NULL)
>  {
>  }
>  
> 
> Also, while debugging this, I ran into a deadlock situation when using
>  --verbose all, and this change fixes it for me as well :
> 
> diff --git a/mythtv/libs/libmythbase/mythverbose.h b/mythtv/libs/libmythbase/mythverbose.h
> index 6c90127..d57924a 100644
> --- a/mythtv/libs/libmythbase/mythverbose.h
> +++ b/mythtv/libs/libmythbase/mythverbose.h
> @@ -137,9 +137,10 @@ extern MBASE_PUBLIC unsigned int print_verbose_messages;
>              {                                                                        \
>                  QDateTime dtmp = QDateTime::currentDateTime();                       \
>                  QString dtime = dtmp.toString("yyyy-MM-dd hh:mm:ss.zzz");            \
> +                QString dargs(__VA_ARGS__);                                          \
>                  verbose_mutex.lock();                                                \
>                  std::cout << dtime.toLocal8Bit().constData() << " "                  \
> -                     << QString(__VA_ARGS__).toLocal8Bit().constData() << std::endl; \
> +                     << dargs.toLocal8Bit().constData() << std::endl;                \
>                  verbose_mutex.unlock();                                              \
>              }                                                                        \
>          } while (0)
> 
> I can attach these to a ticket if needed.
> 
I've tried the code change above and have not yet triggered the deadlock
problem seen without it. Will continue testing and watching for the problem.

Bruce


More information about the mythtv-dev mailing list