$ ./python_db_test.py Python Version : 2.7.15rc1 SQL Driver Version: ('MySQLdb', 1, 3, 10, 'final', 0) This test run in 2 steps: - tc #1 uses the old version of MysqlDB.ping: '_ping121(self): self._get_db().ping(True)' - tc #2 uses the new version of MysqlDB.ping: '_ping122(self): self._get_db().ping()' Each test connects to mysql via the MythTV Python Bindings and checks connection recovery after a timeout occured. Note: MythTV Python uses a pool of connections to MysqlDB. For test purposes, this script allows only one connection at a time. Connect to MythDB (tc = 1) : Allow only one connection from Python Bindings to mysql: MythDB.db.resizePool(1) MYSQL version : 10.1.34-MariaDB-0ubuntu0.18.04.1 Connection_ID : 152 current SQL timeouts for this session: session.wait_timeout : 28800 session.interactive_timeout : 28800 Connection_ID : 152 set session timeouts to 60 secs: Connection_ID : 152 session.wait_timeout set to 60 session.interactive_timeout set to 60 check again current timeouts: session.wait_timeout : 60 session.interactive_timeout : 60 Connection_ID : 152 sleep 50 secs (should not time out) ... ping db connection with _ping121() sleep 50 secs (should not time out) ... ping db connection with _ping121() sleep 80 secs (should time out) ... ping db connection with _ping121() Connection_ID : 153 Is this Connection_ID ident to the original one ( 152 <> 153 ) ? Connect to MythDB (tc = 2) : Allow only one connection from Python Bindings to mysql: MythDB.db.resizePool(1) MYSQL version : 10.1.34-MariaDB-0ubuntu0.18.04.1 Connection_ID : 154 current SQL timeouts for this session: session.wait_timeout : 28800 session.interactive_timeout : 28800 Connection_ID : 154 set session timeouts to 60 secs: Connection_ID : 154 session.wait_timeout set to 60 session.interactive_timeout set to 60 check again current timeouts: session.wait_timeout : 60 session.interactive_timeout : 60 Connection_ID : 154 sleep 50 secs (should not time out) ... ping db connection with _ping122() sleep 50 secs (should not time out) ... ping db connection with _ping122() sleep 80 secs (should time out) ... ping db connection with _ping122() XXX rollback called ! Traceback (most recent call last): File "./python_db_test.py", line 126, in %(connection_id_1, connection_id_2) ) File "/usr/lib/python2.7/dist-packages/MythTV/database.py", line 1431, in __exit__ def __exit__(self, ty, va, tr): return self.db.__exit__(ty, va, tr) File "/usr/lib/python2.7/dist-packages/MythTV/connections.py", line 181, in __exit__ cursor.rollback() File "/usr/lib/python2.7/dist-packages/MythTV/_conn_mysqldb.py", line 108, in rollback self._get_db().rollback() _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')