-- Randy
-- Randy
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
I think you might have to audit all the DCHECK() calls, I think I've seen some that call internal validation routines, and we don't want those slowing down the app on end users. The rule has always been that code copiles away in a build we ship to uses, so changing something that fundamental probably means a revisit of all the uses.
My take on that is that it would be actionable in some cases and not
in others, and if you wanted more data you could change the
DCHECK->CHECK in a canary. Conceivably, we could also send back the
stack, but that starts feeling like a lot more information than we
want to cram into UMA. (I'm also not sure when privacy concerns start
to creep in here.)
-- Randy
> James
>
Worse, we actually have some uses of DCHECK that aren’t really
checking anything, but are just used as a convenient way to enable
other forms of checking that shouldn’t be happening at all in official
released builds.
One recent example is the Mac Objective-C zombie catcher. Its exact
details are unimportant, but it’s new code that we don’t necessarily
trust yet in all cases, so we turn it on like this:
bool ZombieEnable() {
// Set up a bunch of infrastructure that will LOG(FATAL) or cause CHECK
// failures in the presence of the undead.
return true; // Unconditionally
}
int main(int argc, char* argv[]) {
DCHECK(ZombieEnable());
}
This relies on the DCHECK’s condition not executing in builds where
it’s not appropriate to test DCHECKs.
The above example may not be the best in terms of clear coding style,
and the DCHECK above actually does come with a comment in the codebase
that explains what it’s doing, but the fact remains that we do have
uses of DCHECK expressions that mask expensive logic or checks that
are otherwise unwanted in official release builds.
Let’s not forget the added bloat impact.
If we have something that we want to CHECK in release builds, it
should be a CHECK, not a DCHECK.
I think a more productive option might be to build a new something,
call it an UMA_CHECK(), which would histogram on failure. You could
probably narrow down to specific items by having multiple histograms,
perhaps one on hash(#condition), one on hash(__FUNCTION__), and one on
hash(__FILE__). [I'm assuming __LINE__ is too variable to be very
helpful.] It could devolve to DCHECK() in debug builds, though I can
see arguments either way.
A core problem with anything of this sort is that if you wake up one
day thinking "I wonder if there's a problem", and you look at the
histogram, you WILL find a problem. You just won't know when the
problem landed.
-scott
On Tue, Sep 13, 2011 at 8:09 AM, Randy Smith <rds...@chromium.org> wrote:
What does "histogram on failure" mean exactly? If you don't track
successes, then you don't get much information out of tracking
failures, because you have no scale. It sounds like this would just a
boolean histogram with a unique name, say
UnexpectedCondition.<DescriptiveNameHere>, and then you'd have a
percentage of how often it's happening. No creation of new macros
necessary--or is the concern that we'd want to do too many of these to
make it convenient to give each a unique name?
-Stuart
Do you have a concrete problem you're trying to solve, or is this
mostly out of curiosity? (Our Dbg test bots see DCHECKs – does the
download system not have enough unit test coverage?)
Nico
Just example: currently we do not support non-UTF8 cookies (crbug
77771). In the field it easily triggers DCHECK violation in
base/values.
IMHO collecting such statistics on failing DCHECKs would highlight
those issues and give additional incentive to fix them.
No concrete problem I'm trying to solve, just looking for new ways to
get more of a handle on stability related issues. The downloads
system is indeed weak on test coverage--one of our action items--but
while it's weak, I don't think it's completely out of striking range
of the rest of the system (i.e. I don't actually believe that Chrome
as a whole has really good unit test coverage). My goals here is on
improving overall Chrome stability--I was just offering downloads as a
possible test case.
-- Randy
>
> Nico
>
It sounds like you already know the answer to the boolean query "is
the DCHECK being hit", which is all Randy's proposal would really tell
you. If you want to know how common something is, you should actually
add a real metric for it.
(And, as Peter said, fix the DCHECK.)
-Stuart
Is there something more I can do beyond filing a bug for DCHECK()'s
that I may encounter, to ensure they get "addressed immediately"?
Should I be setting priority or adding some tags to them?
-Alexei