I am working on Magento site and I get this error:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away on running
cron job magento
If you have any actions which do not operate with Magento DB for more than 20 seconds (I met shared hosting with such wait_timeout=20), you have to close DB connection. Magento will create new connection on next call to DB.
Mage::getSingleton('core/resource')->getConnection('read')->closeConnection();