I've got a dev version of a site up on a rackspace Cloud Server. The site is built on CodeIgniter and we occasionally get the error mysqli::real_connect(): MySQL server has gone away. I have not yet been able to determine any pattern to when this happens, but it seems to happen first thing in the morning after an extended period where no one is accessing the server. I do NOT think this error is happening in connection with any length query. This seems really fishy to me and I'm wondering if maybe CodeIgniter is to blame for it. Would [man]mysqli_connect[/man] ever return this error under any conditions? I'm wondering if maybe the db server might get swapped out of memory or something while no one is accessing it at night and then when we hit it first thing in the morning, that first query attempt may trigger a sizeable disk access or something that triggers a timeout.
Or alternatively, it may be that the db server (which is a separate, dedicated machine from the web server running PHP) might have somehow disconnected.
More detail on the error.
http://dev.mysql.com/doc/refman/5.5/en/gone-away.html