Score 1 for MailNews Automated Tests

After the mailnews/ and mail/ source trees reopened yesterday, I checked in a whole bunch of patches that had been queued up during the freeze. Some of them had been in my development tree, some of them hadn’t.

A little while later the SeaMonkey unit test tinderbox was orange. This surprised me, as I was fairly sure I had run all the mailnews tests with the various patches.

It turns out one of the patches (a follow up to bug 424570) had caused a regression where deleting address book cards wouldn’t work properly. This was one of those cases where before we had unit tests I wouldn’t have been surprised if we hadn’t detected the regression for a while.

So as Dan said, score 1 for MailNews automated tests. Although we’ve already seen regressions caught many times for the core tests, its good to see that the MailNews ones are now starting to catch regressions as well.

Thunderbird Test Day

Today is the first Thunderbird test day using the potential Shredder Alpha 1 builds. Find out more about the test day here.

Having been working on various bits of Thunderbird’s Core MailNews code (and some of the specific code as well) since the Mozilla 1.8 branch was originally cut, it is exciting to be getting close to releasing the first alpha since the last major release. Whilst there is lots more work to do to get us to the final, its the first big step in the right direction.

So, please do come along and help us test the alpha candidates. The more testing we get, the more confidence we’ll have in the candidates (assuming no failures!), and feedback will help us learn where we need to improve for the next alphas, betas and the final.

Soon to be a few less (minor) MailNews Memory Leaks

(I actually found the bugs a few days ago, but only just got round to blogging about it)

A couple of days ago, I was reviewing a patch and came across a function call to an interface of the type:

void foo(out unsigned long aCount, [array, size_is(count)] out bar aResult);

Where bar was an object derived from nsISupports. The aResult was being freed with NS_Free, instead of NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY. This would have ended up with MailNews leaking most of the objects in the array.

Being curious about where this came from, I did a quick search for the function, and found one instance already in the main code base, where we called NS_Free instead of the NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY. It wasn’t a major leak and would only happen on migration of some of the tag preferences, and for most users would probably end up being 300 bytes. However bug 431404 was raised, and that will soon be checked in.

Having realised that at least one instance in MailNews did this wrong, I did a quick audit of the other function calls in MailNews that obtain an array in the style above. A bit of searching later and I filed the patch on bug 431414, this fixes several leaks in migration, one potential leak in the LDAP autocomplete code, and two leaks related to getting/receiving mail.

The leaks I found when getting/receiving mail, really are small, effectively 4 or 8 bytes per message or newsgroup post, so you probably won’t notice too much difference. These also won’t show up on the Leak stats as we don’t currently receive messages in those tests (that is one of the things I want to extend those tests to do).

Improving MailNews performance, reducing leaks, bloat etc, is something I really want to see happen, this is one small step along the road, and I’ll certainly be looking out for more instances where we do our memory management wrong.