On 9/22/2016 12:28 AM, Nicholas Nethercote wrote:

Assertions, such as MOZ_ASSERT, are great. But they only run in debug builds.

Release assertions, such as MOZ_RELEASE_ASSERT, run in all builds.

I want to highlight a nice case where converting a normal assertion
into a release assertion was a win. In bug 1159244 Michael Layzell did
this in nsTArray::ElementAt(), to implement a form of always-on array
bounds checking. See
https://bugzilla.mozilla.org/show_bug.cgi?id=1159244#c55 for
discussion of how this is finding real bugs in the wild. (As well as
identifying new bugs, it's also helping understand existing crash
reports, e.g. see bug 1291082 where the crash signature changed.)

Obviously we can't convert every normal assertion in the codebase into
a release assertion. But it might be worth thinking about which normal
assertions are good candidates for conversion. Good candidates include
any assertion where the consequence of failure is dangerous, e.g.
might cause memory access violations.


For grins I ran the socorro query from the bug report against Thunderbird https://crash-stats.mozilla.com/search/?moz_crash_reason=~ElementAt&product=Thunderbird&_sort=-date&_facets=signature&_facets=moz_crash_reason&_columns=date&_columns=signature&_columns=product&_columns=version&_columns=build_id&_columns=platform#facet-signature

dev-platform mailing list

Reply via email to