Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Issue 6577013: Crash when we notice a corruption of the histogram range-vector... (Closed)

Created:
9 years, 10 months ago by jar (doing other things)
Modified:
9 years, 7 months ago
CC:
chromium-reviews, brettw-cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Crash when we notice a corruption of the histogram range-vector The range vector is calculated once when a histogram is constructed, and should never change over the lifetime of the histogram. When it does change, it means that memory is being overwritten. We now crash (via CHECK) when there is any detected corruption of the range vector. This CL uses a more robust check-sum algorithm to detect corruption of the vector. The previous algorithm just did a sum, and was too easilly tricked by small (offsetting) changes in several ranges. Hopefully, this CRC-32 implementation will not be so easilly fooled. I had to refactor the class to ensure that each histogram was completely constructed before I registered it. The old code could sometimes register a base class (tradtional Histogram, with exponential bucket spread) and then run the derived constructor (such as when creating a LinearHistogram, with a second construction of the ranges and checksum). I now carefully avoid generating the checksum until fully constructing the instance, and then I run InitializeBuckets only once on the instance before registering it. bug=73939 r=mbelshe Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=76239

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Total comments: 6

Patch Set 12 : '' #

Patch Set 13 : '' #

Patch Set 14 : '' #

Patch Set 15 : '' #

Patch Set 16 : '' #

Patch Set 17 : '' #

Patch Set 18 : '' #

Patch Set 19 : '' #

Patch Set 20 : '' #

Patch Set 21 : '' #

Total comments: 1

Patch Set 22 : '' #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -66 lines) Patch
M base/metrics/histogram.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 7 chunks +20 lines, -15 lines 2 comments Download
M base/metrics/histogram.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 17 chunks +126 lines, -44 lines 0 comments Download
M base/metrics/histogram_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +24 lines, -1 line 0 comments Download
M chrome/common/metrics_helpers.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +12 lines, -0 lines 0 comments Download
M net/disk_cache/stats_histogram.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -0 lines 0 comments Download
M net/disk_cache/stats_histogram.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +13 lines, -6 lines 4 comments Download

Messages

Total messages: 11 (0 generated)
jar (doing other things)
If you care about the details of the CRC code, you can see very similarly ...
9 years, 10 months ago (2011-02-25 00:48:17 UTC) #1
Mike Belshe
http://codereview.chromium.org/6577013/diff/6010/base/metrics/histogram.cc File base/metrics/histogram.cc (right): http://codereview.chromium.org/6577013/diff/6010/base/metrics/histogram.cc#newcode25 base/metrics/histogram.cc:25: const uint32 Histogram::kCrcTable[256] = {0x0, 0x77073096L, 0xee0e612cL, this table ...
9 years, 10 months ago (2011-02-25 01:21:18 UTC) #2
jar (doing other things)
Ricardo: I refactored construction of a histogram, vs initialization of the buckets, and this change ...
9 years, 10 months ago (2011-02-26 17:19:55 UTC) #3
jar (doing other things)
SVN appears to have returned to its senses, and either of you can review version ...
9 years, 10 months ago (2011-02-26 17:28:49 UTC) #4
Mike Belshe
lgtm http://codereview.chromium.org/6577013/diff/10017/base/metrics/histogram.cc File base/metrics/histogram.cc (right): http://codereview.chromium.org/6577013/diff/10017/base/metrics/histogram.cc#newcode564 base/metrics/histogram.cc:564: if (kUseRealCrc) { nit: funky space
9 years, 9 months ago (2011-02-28 17:19:13 UTC) #5
jar (doing other things)
Corrected style nits per mbelesh's comment.
9 years, 9 months ago (2011-02-28 18:20:09 UTC) #6
commit-bot: I haz the power
Try job failure for 6577013-10025 on win: http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win&number=18199
9 years, 9 months ago (2011-02-28 18:34:19 UTC) #7
rvargas (doing something else)
http://codereview.chromium.org/6577013/diff/10025/base/metrics/histogram.h File base/metrics/histogram.h (right): http://codereview.chromium.org/6577013/diff/10025/base/metrics/histogram.h#newcode660 base/metrics/histogram.h:660: static void Register(scoped_refptr<Histogram>* histogram); In general, I would consider ...
9 years, 9 months ago (2011-02-28 19:50:53 UTC) #8
jar (doing other things)
http://codereview.chromium.org/6577013/diff/10025/base/metrics/histogram.h File base/metrics/histogram.h (right): http://codereview.chromium.org/6577013/diff/10025/base/metrics/histogram.h#newcode660 base/metrics/histogram.h:660: static void Register(scoped_refptr<Histogram>* histogram); On 2011/02/28 19:50:53, rvargas wrote: ...
9 years, 9 months ago (2011-02-28 22:11:44 UTC) #9
rvargas (doing something else)
http://codereview.chromium.org/6577013/diff/10025/net/disk_cache/stats_histogram.cc File net/disk_cache/stats_histogram.cc (right): http://codereview.chromium.org/6577013/diff/10025/net/disk_cache/stats_histogram.cc#newcode35 net/disk_cache/stats_histogram.cc:35: StatsHistogram* stats_histogram = new StatsHistogram(name, minimum, maximum, On 2011/02/28 ...
9 years, 9 months ago (2011-02-28 23:05:33 UTC) #10
jar (doing other things)
9 years, 9 months ago (2011-03-01 00:21:18 UTC) #11
http://codereview.chromium.org/6577013/diff/10025/net/disk_cache/stats_histog...
File net/disk_cache/stats_histogram.cc (right):

http://codereview.chromium.org/6577013/diff/10025/net/disk_cache/stats_histog...
net/disk_cache/stats_histogram.cc:35: StatsHistogram* stats_histogram = new
StatsHistogram(name, minimum, maximum,
On 2011/02/28 23:05:33, rvargas wrote:
> Wouldn't it be better just to make histogram a
> StatsHistogram, and also get rid of return_histogram?

You're code was fairly special (starting around lines 47) where you manually
up-cast to a derived class.  The pattern I used here (leading to line 42) mimics
what I did in the other derived class (which didn't need an upcast).

The original call to FindHistogram() handles only the base class type, and can't
accept a StatsHistogram* (or smart pointer).  The Register() function also has
to take a base-class type (now that it too can do an assignment to the
referenced argument), so it too can't take a StatsHistogram.

By keeping the pattern more similar in this derived class, I figured it would be
easier (in the future, if necessary) to merge future changes.

Powered by Google App Engine
This is Rietveld 408576698