﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
946	MySQL server gone away bug with MySQL 4.1 and 5.0	d.r.newman@…	Isaac Richards	"Ever since I changed to MySQL 4.1 and then MySQL 5.0, mythtv has been falling over 2 or 3 times a week. Mythbackend looses its connection to MySQL, and keeps attempting to kick the database into life. I get lots of errors like the extract I have pasted below. I have not detected a consistent pattern causing the loss of MySQL connection, although I have noticed it happens if mythtv does not do any recording for a day, and when I am quickly browsing through the menus.

In the source code, there are several references to code written to get around bugs in the way MySQL3 behaves. Perhaps the MySQL oddities have been fixed in the more recent version, so the work-arounds no longer work.

I don't understand the code well enough to fix it myself, but I am happy to test code sent to me by others.

One possible fix would be to give up persistent connections for good, and just open a new connection every time mythbackend wants to connect to the database. After all, mythbackend doesn't hit the database all that much, compared to your typical CMS on a web server.
{{{
 --<part of mythbackend.log>--
 2006-01-05 08:23:31.245 Started recording ""Will and Grace"" on channel: 4 on cardid: 1, sourceid 1
 DB Error (KickDatabase):
 Query was:
 SELECT NULL;
 Driver error was [2/2006]:
 QMYSQL3: Unable to execute query
 Database error was:
 MySQL server has gone away

 2006-01-05 08:23:31.249 scheduler: Schedule Change
 DB Error (KickDatabase):
 Query was:
 SELECT NULL;
 Driver error was [2/2006]:
 QMYSQL3: Unable to execute query
 Database error was:
 MySQL server has gone away

 DB Error (KickDatabase):
 Query was:
 SELECT NULL;
 Driver error was [2/2006]:
 QMYSQL3: Unable to execute query
 Database error was:
 MySQL server has gone away
}}}"	defect	closed	major	unknown	mythtv	head	medium	invalid	MySQL server connection		0
