Stalled MySQL Logins

If you ever see a list like this in your MySQL process list, run!

+---------+--------------------------------------------+--------------------------------+------------+-----------------+------------+-------------+------------+
| Id  | User                 | Host           | db   | Command | Time | State | Info |
+---------+--------------------------------------------+--------------------------------+------------+-----------------+------------+-------------+------------+
| 442 | unauthenticated user | 10.1.1.2:55885 | NULL | Killed  | NULL | login | NULL | 
| 443 | unauthenticated user | 10.1.1.1:48009 | NULL | Killed  | NULL | login | NULL | 
.....
| 444 | unauthenticated user | 10.1.1.1:58105 | NULL | Killed  | NULL | login | NULL | 
| 445 | unauthenticated user | 10.1.1.2:60799 | NULL | Killed  | NULL | login | NULL | 
+---------+--------------------------------------------+--------------------------------+------------+-----------------+------------+-------------+------------+

No seriously. Apparently it’s something of a known bug which comes up at unpredictable points in time.

One proposed solution is to add all your internal hosts which can’t be looked up through DNS to your /etc/hosts file:

10.1.1.1    appserver1
10.1.1.2    appserver2

Et voila. The exact same moment, all the users were authenticated. Scary? Yes. Weird? Yes. Problem solved? Yes.

Rails 2.0: It’s Done

After more than two days of removing deprecation warnings, adding plugins, fixing some custom additions, going through the whole application, it’s finally done. We’re running Rails 2.0. Nothing more gratifying than seeing this, well except for the application running without problems:

MySQL No-Nos: ORDER BY RAND()

It’s a classic. You want to return random rows from a table, say a collection of random users in your social network. Easy, MySQL’s ORDER BY RAND() to the rescue. After all, everybody’s doing it. At least on my last search on that topic, all the PHP kids did it.