I have many posts about this issue. My understanding is that the application has a parameter that says how long to maintain idle database connections before dropping them and creating new ones. MySQL has a parameter that says how long to maintain idle connections. After the site is inactive, MySQL does not connect applications. But the application does not know this and is still trying to use an existing connection that fails. After the failure, the application drops the connection and creates a new one, and then this is normal.
I have wait_timeout set to 10 seconds on my local mysql server. I have pool_recycle set to 5 seconds on my locally running application. After 10 seconds of inactivity, I make a request and still get this error. Fulfilling another request later within 10 seconds then it is fine. Waiting more than 10 seconds, he again gives this error.
Any thoughts?
mysql> SELECT @@global.wait_timeout\G
*************************** 1. row ***************************
@@global.wait_timeout: 10
1 row in set (0.00 sec)
.
sqlalchemy.twelvemt.pool_recycle = 5
.
engine = engine_from_config(settings, 'sqlalchemy.twelvemt.')
DBSession.configure(bind=engine)
.
OperationalError: (OperationalError) (2006, 'MySQL server has gone away') 'SELECT beaker_cache.data \nFROM beaker_cache \nWHERE beaker_cache.namespace = %s' ('7cd57e290c294c499e232f98354a1f70',)
source
share