Ayende @ Rahien

Refunds available at head office

How to fix a bug

Yesterday I added a bug to Rhino Service Bus. It was a nasty one, and a slippery one. It relates to threading nastiness with MSMQ, and the details aren’t really interesting.

What is interesting is how I fixed it. You can see the commit log here:

image 

At some point, it became quite clear that trying to fix the bug isn’t going to work. I reset the repository back to before I introduced that bug (gotta love source control!) and started reintroducing my change in a very controlled manner.

I am back with the same functionality that I had before I reset the code base, and with no bug. Total time to do this was about 40 minutes or so. I spent quite a bit longer than that just trying to fix up that.

Lesson learned, remember to cut your losses early :-)

Comments

Aaron Jensen
01/26/2009 06:16 AM by
Aaron Jensen

Looks like a good time to wish you had git bisect ;)

Bruce Boughton
01/27/2009 12:55 PM by
Bruce Boughton

@Aaron: why? Looks like it was easy enough to do a reverse merge in subversion. I don't see what Git offers here.

Thom
01/27/2009 08:45 PM by
Thom

@Bruce: git bisect does a binary search to help find the exact revision that caused the bug. There's a similar command for SVN written in perl.

Comments have been closed on this topic.