I'm looking after a rails app running Passenger, and MySQL, on a VPS running Ubuntu Intrepid and earlier this morning, the webserver stopped being able to connect to the server. My exception notifier sent me a message with this error:
ActionView::TemplateError: Mysql::Error: MySQL server has gone away: SELECT * FROM `table_name` WHERE (`table_name`.`id` = 70)
Shelling into the vps trying to open up mysql gave me this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I cleared this error by stopping apache, rebooting the database server and restarting passenger, which seems to have everything humming along fine again, but this doesn't solve the problem of working out why this happened in the first place.
Which places should I be looking to find the cause of this error? (other than production.log, or a /var/log ), so I can avoid this in future, and seeing that this was so simple to fix, would it be worth automating a reboot of the two servers if these conditions occurred again in future?