It looks like it's all revolving around this error:

SQL Error: MySQL server has gone away

Either the MySQL server is dying, or the connection is being lost for some reason. Is this your own server or a hosted server?