I got an error message from MySQL last week that said, “The MySQL server has gone away.” I thought it an odd message, but since I was changing settings, configuring a driver, and experimenting with my program, I figured that my fiddling had somehow caused me to execute a query against a closed connection. So I ignored the error and went about my business. Since the error didn’t crop up again, I forgot all about it.
The error came back yesterday and camped on my front door. A quick search of the MySQL Reference Manual revealed the topic MySQL server has gone away in an appendix. Here are some of the things that can cause this error message:
- The server timed out and closed the connection.
- Attempting to to execute a query against a closed connection.
- You don’t have sufficient privileges to execute the query.
- The server, the TCP connection, the Windows client, or something else timed out.
- Sending a query that is too large.
- Attempting to execute an incorrect query.
- You have mismatched server and client versions.
- Attempting to use the same connection from multiple threads.
- A blocked port on the firewall.
- A bug in the server.
Helpful, isn’t it? For all the good it does me in locating the problem, the message might just as well have said, “Something bad happened.” I spent an inordinate amount of time checking timeout values and permissions, checking my query for validity, verifying client versions, making sure that my multi-threaded program wasn’t trying to re-use a connection, and finally writing diagnostic code to check the length of my queries against the maximum allowed length. That was the problem, by the way: a very large query.
This is asinine. Why couldn’t MySQL tell me the exact error message? It looks to me like some lazy programmer decided to save himself time at my (and others’) expense.
On a related note, the MySQL ODBC driver for Windows is a huge disappointment. First, there’s no 64-bit version, forcing me to make my data broker a 32-bit program. I’d be more understanding if this was 2005, but 64-bit versions of Windows have been out for at least two years. Isn’t it about time somebody upgraded that ODBC driver?
The ODBC driver also has a very nasty UTF-8 bug that is being ignored by the developers.
I’ve heard good things about MySQL, but I’m not yet favorably impressed. I can’t argue with the price, though, and for all the headaches it does seem reliable. I haven’t lost any data. Yet?