[mythtv-users] mythbackend "Lost connection to MySQL server during query" error?

Tom Dexter digitalaudiorock at gmail.com
Sun Jun 13 13:17:33 UTC 2021

On 6/13/21, Tom Dexter <digitalaudiorock at gmail.com> wrote:
> I'm runing MythTV 29.1 under gentoo, with MariaDB 10.4. Yesterday
> morning I had something happen that I've never had before. I noticed
> that the system showed no upcoming recordings at all.
> What I discovered in the mythbackend log was that, when the reschedule
> was triggered by myhthfilldatabase at about 9 AM, the SQL queries all
> failed to prepare. The first of those errors indicated a lost mysql
> connection:
> 2021-06-12 09:07:28.346179 E [1492/1708] Scheduler mythdbcon.cpp:872
> (prepare) - Error preparing query: DELETE recordmatch FROM
> recordmatch, channel WHERE recordmatch.chanid = channel.chanid
> 2021-06-12 09:07:28.346221 E [1492/1708] Scheduler mythdbcon.cpp:874
> (prepare) - Driver error was [2/2013]:
> QMYSQL3: Unable to prepare statement
> Database error was:
> Lost connection to MySQL server during query
> A simple restart of the mythbackend corrected everything.
> On Thursday I'd run a pretty big update in gentoo, though I don't
> think that's related, especially since everything had worked find
> after that update. The update did include a minor update to
> dev-db/mysql-connector-c, which I know is used by dev-qt/qtsql, but
> again, I doubt that's related. Also note that there's no indication
> that anything happened with mysql itself. It was running the whole
> time without any errors etc.
> I know that the mysql wait_timeout is 8 hours, and as it turns out,
> the backend was in fact pretty idle for quite some time before that
> failure. For example, the only notable activity in the log before that
> failure was a reschedule 12 hours earlier.
> Can a long idle period that exceeds the mysql wait_timeout cause that?
> I'd think that if that were the case, I would have run into this
> sometime in all the years of running MythTV.
> Thanks in advance!
> Tom

Wow...This happened again when mythfilldatabase ran this
morning...exact same thing. And again, a backend restart fixed it.
Also note that after a restart of the backend, running
mythfilldatabase works fine, so I know it's not that specifically.

I'm going to re-compile dev-qt/qtsql to see if that helps, though the
Gentoo update really should have recompiled that if it was needed. Any
suggestions would be appreciated.


More information about the mythtv-users mailing list