Tech Stuff

Thought on Tracking Down Troublesome WordPress Plugins

There’s an old puzzle you might know. You’re given nine coins and a balance scale. One of the coins is lighter than the rest and you have to figure out which — but you can only use the scale twice.

The common advice you’re given if you have a plugin that’s crashing your site is, deactivate all the plugins and then re-activate them one-by-one until you find the problem. The thing is, if you have 27 different plugins that’s 27 different activation/reactivation processes you have to wade through to find the source. And if you are running a multi-site installation where people are depending on plugins for really basic things (like logging in), even if you’re happy spending the time doing it, the downtime might be unacceptable.

What I’ve found works well is to just deactivate half of them. If the problem goes away, it must be one of them; if the problem remains, it’s somewhere in the half that remained active. So take the offending half and test half of them, and so on, until you find the problem.

If you have 25 plugins active, you’ll need to do a maximum of four tests. Much better than a maximum of 25.

To find the odd coin out of nine, divide them into three groups of three:

1 2 3    4 5 6    7 8 9

Put the first group on one side of the scale, and the second group on the other. Set the third group aside.

[ 1 2 3 ]   [ 4 5 6 ]   --> [ 7 8 9 ]

If the two groups on the scale are equal, your odd coin isn’t there — it must be in group 3, the group you set aside. You’ll do your second weighing with that group.

If one of the groups on the scale weighs less, that’s where your odd coin is. You’ll do the second weighing with them.

Whichever group you’re testing, put one coin on the left side of the scale and one on the right. Set the third aside.

[ 1 ] [ 2 ]   --> [ 3 ]

Obviously if one coin is lighter, that’s the one you’re looking for. If the coins in the balance are equal, the coin you set aside is the light one.

Tom McGee has been building web sites since 1995, and blogging here since 2006. Currently a senior developer at Seton Hall University, he's also a freelance web programmer and musician. Contact him if you have the need for a blog, web site, redesign or custom programming!

Leave a Reply

Your email address will not be published. Required fields are marked *