Forums

Intermittent loss of MySQL connection

Hi all, My Python app is losing it's connection to the MySQL server intermittently. I'm approaching a time when this app will get heavy use for one day and I need this to be stable. I believe this is a Python Anywhere problem since the app is stable most of the time. Any suggestions or feedback would be much appreciated.

Thanks

From the Error Log:

2017-08-28 12:40:41,986: OperationalError: (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'SELECT ab_role.id AS ab_role_id, ab_role.name AS ab_role_name \nFROM ab_role \nWHERE ab_role.name = %s \n LIMIT %s'] [parameters: ('Public', 1)]
2017-08-28 21:48:10,118: OperationalError: (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'SELECT ab_role.id AS ab_role_id, ab_role.name AS ab_role_name \nFROM ab_role \nWHERE ab_role.name = %s \n LIMIT %s'] [parameters: ('Public', 1)]
2017-08-31 21:25:21,061: OperationalError: (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'SELECT ab_role.id AS ab_role_id, ab_role.name AS ab_role_name \nFROM ab_role \nWHERE ab_role.name = %s \n LIMIT %s'] [parameters: ('Public', 1)]

2017-09-03 17:14:30,755: OperationalError: (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'SELECT ab_role.id AS ab_role_id, ab_role.name AS ab_role_name \nFROM ab_role \nWHERE ab_role.name = %s \n LIMIT %s'] [parameters: ('Public', 1)]
2

Jim

You need to properly manage your connections: http://help.pythonanywhere.com/pages/ManagingDatabaseConnections/

Sorry to ask newbie questions. I've made the change and am testing now. Thanks for the quick response.