Hello folks,
Each morning I encounter the following error.
OperationalError('(OperationalError) (2006, "MySQL server has
gone away (error(32, \\'Broken pipe\\'))")',)
And thus the first sync fails. This of course is due to the MySQL
default connection timeout setting of 28800 seconds (8 hours). Although
slightly annoying it is not a huge issue because the connection is
restored after this.
Should the following fix be sufficient to circumvent this error?
>~~~~~~~<
weave:~/syncserver/syncserver$ git diff staticnode.py
diff --git a/syncserver/staticnode.py b/syncserver/staticnode.py
index d758aad..1b3b76c 100644
--- a/syncserver/staticnode.py
+++ b/syncserver/staticnode.py
@@ -118,6 +118,12 @@ class StaticNodeAssignment(object):
if urlparse.urlparse(sqluri).path.lower() in ("/",
"/:memory:"):
sqlkw["pool_size"] = 1
sqlkw["max_overflow"] = 0
+ if self.driver == "pymysql":
+ # MySQL features an automatic connection close behavior, for
+ # connections that have been idle for eight hours or more. To
+ # circumvent having this issue, use the pool_recycle option
+ # which controls the maximum age of any connection.
+ sqlkw["pool_recycle"] = 3600
self._engine = create_engine(sqluri, **sqlkw)
users.create(self._engine, checkfirst=True)
>~~~~~~~<
It doesn't seem to hurt anyway. I didn't have the message in the log
this morning but it might be an early conclusion because the time
between syncs was just around 8 hours.
Regards,
Feico
_______________________________________________
Sync-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/sync-dev