Always Google your error messages

Because someone has already had your problem.

Watching other people debug is fascinating. I occasionally find myself spotting my coworkers or friends as they try to find the cause of a bug or the fix for a crash. Next time you get called over to someone's desk, really watch as they show you the problem, and show you what they've tried. Of course, you're helping to look for the fix, but also pay attention to them. There's a big opportunity here if you study their approach as well.

You can learn a lot about how a person thinks about and internalizes code and architecture by watching the way they try to fix a bug. Methodologies and thought-processes are more different than you would ever expect. I respect a healthy difference in debugging approaches — it means a friend is more likely to find a fix for something that I overlooked, and vice-versa — but there's one thing that always bothers me:

When people don't Google their error messages.

The number of times I've seen someone get a cryptic error message, say What the hell does that mean?!, and then go back to rummaging in their code ... disturbing.

Unless it's an error from your in-house code, or you're working on something incredibly niche, chances are that someone has had the same problem as you in the past. Any time it looks like your error might be due to anything other than your own software, plug it into Google! It works!

Thanks in large part to StackOverflow and the other StackExchange sites, but also to a proliferation of domain-specific forums, you'll almost always get results. And you'll often get an answer too.

Maybe a quarter of the time you'll find threads where someone has had the problem, and a few people have discussed it, and no fix has shown up. Even then it's not a wash, since you just invested all of 2 minutes to learn a handful of things that don't work.

Of course, every now and then you get a soul-crushing defeat, but in the past few years this has become even rarer for me.

Let's do a case study, just for fun.

This one was just today. I was debugging an error in a new client's mod_perl/Embperl application. All the client has is their production server — their original dev environment was eaten by a former contractor — so the first thing we did was build out a proper dev environment again. If you've ever installed someone else's Perl application, you're probably familiar with the hell of missing, undocumented CPAN module dependencies. This was no exception. About 40 CPAN modules later we had a working environment (had to Google a few errors there for unresolved dependencies). Except we found out a few AJAX requests would crash with this:

/usr/sbin/apache2: symbol lookup error: /usr/lib/perl5/auto/APR/Request/Apache2/Apache2.so: undefined symbol: apreq_handle_apache2

Huh? Version incompatibility between Perl's Apache2.so and our Apache or mod_perl version? Bug in the CPAN module? Library misuse? A Google search later yielded this thread, where I found out I just had to run sudo a2enmod apreq. I didn't even know there was an apreq module for Apache. But I now had my fix in about 30 seconds of seeing the error.

I'll try to keep appending more case studies as they come up, but feel free to add your own in the comments!

Comments

comments powered by Disqus