﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
7603	mythfrontend can never connect to just waked up master backend	bam <mybigspam@…>	danielk	"If for some reason frontend has no connection to the backend program, the frontend tries to re-establish it by waking up server/restarting backend/etc, but it can never to re-connect to it, even if the backend was successfully back online.[[BR]]
The frontend's log when the master backend on the same machine is not running:
{{{
2009-11-18 20:54:45.388 Loading menu theme from /usr/share/mythtv/themes/defaultmenu//mainmenu.xml
2009-11-18 20:54:45.411 Found mainmenu.xml for theme 'Retro'
2009-11-18 20:54:46.656 MythContext: Connecting to backend server: 192.168.1.2:6543 (try 1 of 15)
master_wake
2009-11-18 20:54:46.795 MythContext: Connecting to backend server: 192.168.1.2:6543 (try 2 of 15)
2009-11-18 20:54:46.796 MythContext: Wake-On-Lan in progress, waiting...
2009-11-18 20:54:47.796 MythContext: Wake-On-Lan in progress, waiting...
2009-11-18 20:54:48.797 MythContext: Wake-On-Lan in progress, waiting...
2009-11-18 20:54:49.797 MythContext: Wake-On-Lan in progress, waiting...
2009-11-18 20:54:50.798 MythContext: Wake-On-Lan in progress, waiting...
}}}
...and so on.[[BR]]
I have the ""WOLbackendCommand"" setting set to ""echo master_wake"" for debug, but even if I restart the backend by hand, nothing is changed in the log.[[BR]]
The reason is that WaitForWOL() function from libs/libmyth/mythcontext.cpp file can never return:
{{{
bool MythContextPrivate::WaitForWOL(int timeout_in_ms)
{
    int timeout_remaining = timeout_in_ms;
    while (WOLInProgress && (timeout_remaining > 0))
    {
        VERBOSE(VB_GENERAL, LOC + ""Wake-On-Lan in progress, waiting..."");

        int max_wait = min(1000, timeout_remaining);
        WOLInProgressWaitCondition.wait(
            &WOLInProgressLock, max_wait);
        timeout_remaining -= max_wait;
    }

    return !WOLInProgress;
}
}}}
I think this is because there is no threads actually created for the WOL process, and the following code from mythcontext.cpp can never get control:
{{{
01679     if (we_attempted_wol)
01680     {
01681         QMutexLocker locker(&d->WOLInProgressLock);
01682         d->WOLInProgress = false;
01683         d->WOLInProgressWaitCondition.wakeAll();
01684     }
}}}

"	defect	closed	major	0.23	MythTV - General	head	medium	fixed	wol	danielk	0
