[mythtv-users] FIXED: "Lost connection to MySQL server during query"

C Pirih cp at myth2.z.ihoc.net
Fri Aug 25 18:00:47 UTC 2006


I've been getting the "Lost connection to MySQLserver during 
query" error intermittently for quite a while now. Once this 
happens, the backend stops recording (no programs are scheduled) 
until I manually shut it down and restart it.  Needless to say, 
this is very annoying.

I've used a kind of kludge-hammer approach to solving the
problem, since I don't understand MySQL programming well
enough to see what's really going on.  Basically I've wrapped
a retry loop around "CheckTooMany" in Scheduler::AddNewRecords
in programs/mythbackend/scheduler.cpp.  I replaced this:

    rlist.exec();
    if (!rlist.isActive())
    {
        MythContext::DBError("CheckTooMany", rlist);
        return;
    }

with this:

    for (int j = 0; j < 10; j++)
    {
        rlist.exec();
        if (rlist.isActive())
            break;
        MythContext::DBError("CheckTooMany", rlist);
    }
    if (!rlist.isActive())
        return;

I applied this kludge about two months ago, and since then the
backend has survived several of the dreaded "Lost connection"
errors without losing its recording schedules or needing to be
restarted.  The errors never loop, so it would appear that
only one retry is necessary (not ten like I used just in case).

Patch to 0.19 here:

http://www.ihoc.net/mythtv-0.19-CheckTooMany.patch



More information about the mythtv-users mailing list