Opened 11 years ago

Closed 11 years ago

#8903 closed defect (fixed)

Backend doesn't seem to reconnect to restarted mysql

Reported by: beirdo Owned by: beirdo
Priority: minor Milestone: 0.24
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no


If you have to restart your mysqld while the backend is running, it doesn't seem to want to reconnect when the mysqld is running again:

QMYSQL3: Unable to prepare statement
Database error was:
MySQL server has gone away

This particular error should be easy to deal with by simply attempting to reconnect. Ideally, missed queries should be queued, but at least a reconnection should be attempted and the query retried if the reconnection succeeds. Instead, we get an endless stream of errors for every subsequent query.

Change History (3)

comment:1 Changed 11 years ago by robertm

Owner: set to beirdo
Status: newassigned

comment:2 Changed 11 years ago by beirdo

Milestone: unknown0.24

comment:3 Changed 11 years ago by beirdo

Resolution: fixed
Status: assignedclosed

(In [26225]) Make MSqlQuery.exec and .prepare more resiliant to disappearing MySQL connections.

If the database connection is down on entry, it will try to reconnect or fail.

If the .exec or .prepare call fails due to "MySQL server went away" (error code 2006), it will try to reconnect, and if that works, it will retry the call once.

This should keep the frontend and backend (et al) from going absolutely crazy if the mysql server needs to be restarted for any reason. Previously, all further queries would fail, requiring restarts.

Fixes #8903

Note: See TracTickets for help on using tickets.