I have a Python 3.4 program running and about after 8-10 hours, it starts throwing the below exception. The best I found by searching was to set wait_timeout in my.cnf to a higher value but that hasn't worked. I'm connecting with pymysql using autocommit. Any clue on what causes this exception and how to handle it?
Traceback (most recent call last):
File "/home/ntx/.ntx_path/platform/ntx/common/db.py", line 211, in _executemany
self.cursor.executemany(statement, params)
File "/home/ntx/ntx-py3/lib/python3.4/site-packages/pymysql/cursors.py", line 157, in executemany
self.rowcount = sum(self.execute(query, arg) for arg in args)
File "/home/ntx/ntx-py3/lib/python3.4/site-packages/pymysql/cursors.py", line 157, in <genexpr>
self.rowcount = sum(self.execute(query, arg) for arg in args)
File "/home/ntx/ntx-py3/lib/python3.4/site-packages/pymysql/cursors.py", line 135, in execute
result = self._query(query)
File "/home/ntx/ntx-py3/lib/python3.4/site-packages/pymysql/cursors.py", line 274, in _query
conn.query(q)
File "/home/ntx/ntx-py3/lib/python3.4/site-packages/pymysql/connections.py", line 713, in query
self._execute_command(COM_QUERY, sql)
File "/home/ntx/ntx-py3/lib/python3.4/site-packages/pymysql/connections.py", line 892, in _execute_command
self._write_bytes(prelude + sql[:chunk_size-1])
File "/home/ntx/ntx-py3/lib/python3.4/site-packages/pymysql/connections.py", line 852, in _write_bytes
raise OperationalError(2006, "MySQL server has gone away (%r)" % (e,))
pymysql.err.OperationalError: (2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pipe'))")