Daily Archives: January 6, 2008

The power of the test suite.

Since October I’ve used the coadvisor test suite to identify and help fix a number of bugs in Apache’s proxying. Most of these are obscure edge-cases violating the finer points of RFC2616 (the HTTP protocol) and unlikely to affect users, but should nevertheless be fixed.

At the end of November, Jim suggested we should be rolling 2.2.7, and others agreed. As part of that exercise, on December 9th I ran it through the test suite, and identified an unexpected violation. It turned out to be a transcription error in one of my patches, and was straightforward to fix. Then all was well, and we have a better proxy than ever before.

On Jan 4th, Jim rolled pre-release tarballs of new versions including 2.2.7. So I ran that through the test suite, expecting to replicate my results from December 9th. The results showed a regression: two testcases that had previously passed now failed. This time, they had nothing to do with any of my fixes, nor even known bugs from the past. And it’s a clear regression: a bug that wasn’t there in earlier versions. And it’s serious: some users could see apparently-random failures. Ouch!

With a little bit of investigation, I was able to trace the cause of the bug, to a patch to improve efficiency of reading input with better use of nonblocking reads and asynchronous processing of data sent using HTTP chunked encoding. By a cruel twist, the patch was committed also on December 9th, so my previous testing just missed it. And it’s in the Apache core, not mod_proxy, and I wasn’t paying enough attention to realise it might affect the proxy.

And it’s a complex fix: I wasn’t able to figure it out in the time I could give to it. Fortunately Rüdiger applied his formidable hacking skills to it, and has this evening committed a patch that fixes the bug, without taking the easy option of dropping the efficiency gain altogether. So it looks as if the test suite has saved us from releasing a difficult but important bug.

The story isn’t over yet, but appears to be approaching a satisfactory conclusion.