solves the stale connection error by pinging

(OperationalError) (2006, 'MySQL server has gone away')
A new manual test allows you to check the fix.

Change-Id: Ib10a50f15e6942c2034234631f5b598b0d45195c