MySql Times Out

For the past couple of days, I've experienced a lot of MySql connection issues. I haven't changed my code, so I don't think that's the problem. But if I re-start my web app or just "save" my file, everything works again. Can anyone shed light on why this is happening?

Do you have any details on how it fails? Does it time out?

I've had various problems with persistent MySQL connections in the past, so you might like to make sure your code is dealing with the connections properly.

If you're making a new connection per web request, you should be alright, although that's not terribly efficient. However, if you're using a connection pool (a common technique) then it's important to test that the connection is still active if it's been idle for anything more than a few seconds (in a typical web app this means checking each connection as it's taken from the pool). The MySQL C API provides a mysql_ping() function for doing this efficiently, and I believe Python's MySQLdb module exposes this as a ping() method on the connection object.

I don't think we've made any changes recently that would affect MySQL connections. Which web framework are you using (if any)?

I'm using I think it's an issue where my code isn't dealing with connections properly. Thanks everyone