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
I don't have any timeout issues.
I moved a fclose(STDERR) line from my main file to a included file and this started happening.
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
I moved the line back to its original place and problem went away.
Basically, closing STDERR from an included file seems to have some crazy repercussions.