July 7th, 2007

Bugs, bugs, bugs

*sigh* Why is it that the hardest bugs to track down are the ones with the smallest fixes? For the last week, I've been chasing a bug in my branch of yelp (yes, we are working on it). It was producing an xlib error:
Xlib: unexpected async reply (sequence 0x2fa)!

Which looks a lot like a threading issue, does it not? For the last week, I went through and tried to track this down, adding in thread safety and reducing yelp to a bare minimum, but it still appeared, even doing everything in a single thread and using "--sync". It was beginning to haunt my dreams. Seriously. Then, this morning, I had an epiphany. I came up with the problem. It was so elegant. It explained the problem exactly. It explained why it worked sometimes and fell over other times. It was perfect.

I set about testing this and it seemed to confirm it. I spend an hour putting the fix in and ... still the problem reoccurred. Shame. It was the most elegant problem and solution you'd come across. Finally, I managed to track it down this afternoon. It was nothing at all to do with threads. It was due to libxml reading off the end of an array (I forgot to set the final element to NULL). Why does this cause an xlib error? No idea. Anyway, the fix is a single line. I want my week back, please.

And just to echo Bastien's post. if you're coming to GUADEC from outside the UK, bring cheap smokes. You shall find buyers (at least me).