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

Issue 2288473002: Implement Dump-on-DCHECK (via a new LogSeverity). (Closed)

Created:
4 years, 3 months ago by Wez
Modified:
3 years, 10 months ago
CC:
blink-reviews, blink-reviews-wtf_chromium.org, chromium-reviews, Kevin M, Mikhail, Will Harris
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement Dump-on-DCHECK (via a new LogSeverity). This patch adds a new LogSeverity value, LOG_DUMP, available in all builds. LOG_DUMP has similar semantics to LOG_FATAL, except that it uploads a dump without actually crashing, and only does so on the first DUMP-severity failure. A new DCHECK_IS_DUMP_WITHOUT_CRASHING macro is introduced, which modifies the behaviour of the LOG_DFATAL/LOG_DCHECK severity in DCHECK_IS_ON()[1] builds, such that these severities now map to: !DCHECK_IS_ON() (e.g. Release) -> LOG_ERROR DCHECK_IS_ON() -> LOG_FATAL DCHECK_IS_ON() + DCHECK_IS_DUMP_WITHOUT_CRASHING -> LOG_DUMP A new build argument, dump_on_first_dcheck, is set in the GN configuration to enable the DCHECK_IS_DUMP_WITHOUT_CRASHING macro. All non-DCHECK_IS_ON() behaviours, e.g. CHECK, PCHECK, SECURITY_CHECK, are unchanged and continue to be mapped to the LOG_FATAL severity. Dump-on-DCHECK will be enabled in on-off Canary builds by temporarily landing patches to set dump_on_first_dcheck in specific configurations. This underlying LOG_DUMP implementation is intended to remain checked-in indefinitely. BUG=596231 [1] DCHECK_IS_ON() is set in Debug builds, and Release builds with DCHECK_ALWAYS_ON.

Patch Set 1 #

Patch Set 2 : Introduce a LOG_DUMP severity level, for dump-on-DCHECK #

Patch Set 3 : Tweak tests #

Patch Set 4 : Disable some death-tests #

Patch Set 5 : Hacking EXPECT_DCHECK_DEATH #

Patch Set 6 : Enable WTF ASSERTS, and fix DumpWithoutCrashing() call-site #

Patch Set 7 : Rebase #

Patch Set 8 : Rebase & try-bots #

Patch Set 9 : Migrate some tests to EXPECT_DCHECK_DEATH #

Total comments: 11

Patch Set 10 : Tweak PartitionAlloc sanity-DCHECK to a CHECK #

Patch Set 11 : base_unittests passing #

Patch Set 12 : Migrate more tests to EXPECT_DCHECK_DEATH #

Patch Set 13 : Add missing dep #

Patch Set 14 : Rebase #

Patch Set 15 : Fix wtf_unittests #

Patch Set 16 : Fix comparison #

Patch Set 17 : Break out sub-component CLs #

Total comments: 4

Patch Set 18 : Re-wrap comment #

Patch Set 19 : Fix test #

Total comments: 1

Patch Set 20 : Rebase #

Total comments: 3

Patch Set 21 : Pull the Official Windows build default in, and rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -52 lines) Patch
M base/allocator/partition_allocator/partition_alloc.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M base/logging.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 chunks +25 lines, -7 lines 0 comments Download
M base/logging.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 5 chunks +20 lines, -4 lines 0 comments Download
M base/logging_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 10 chunks +60 lines, -22 lines 0 comments Download
M base/syslog_logging.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M base/test/gtest_util.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +14 lines, -13 lines 0 comments Download
M build/config/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +9 lines, -0 lines 0 comments Download
M build/config/dcheck_always_on.gni View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +8 lines, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/Assertions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/wtf/AssertionsTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +8 lines, -1 line 0 comments Download

Messages

Total messages: 99 (79 generated)
Wez
PTAL: Comments on the latest patch set include questions which it'd be good to get ...
4 years ago (2016-12-19 23:57:46 UTC) #38
esprehn
https://codereview.chromium.org/2288473002/diff/160001/third_party/WebKit/Source/wtf/Assertions.h File third_party/WebKit/Source/wtf/Assertions.h (right): https://codereview.chromium.org/2288473002/diff/160001/third_party/WebKit/Source/wtf/Assertions.h#newcode160 third_party/WebKit/Source/wtf/Assertions.h:160: #define ASSERT_NOT_REACHED() NOTREACHED() On 2016/12/19 at 23:57:46, Wez wrote: ...
4 years ago (2016-12-20 03:16:29 UTC) #41
danakj
On Mon, Dec 19, 2016 at 6:57 PM, <wez@chromium.org> wrote: > Reviewers: esprehn, groby, wfh5, ...
4 years ago (2016-12-20 15:09:36 UTC) #42
danakj
On Mon, Dec 19, 2016 at 6:57 PM, <wez@chromium.org> wrote: > Reviewers: esprehn, groby, wfh5, ...
4 years ago (2016-12-20 15:09:36 UTC) #43
Wez
Yes, I'm familiar with EXPECT_DCHECK_DEATH (the latest patch-set updates a couple of tests to use ...
4 years ago (2016-12-20 18:29:36 UTC) #44
Wez
Yes, I'm familiar with EXPECT_DCHECK_DEATH (the latest patch-set updates a couple of tests to use ...
4 years ago (2016-12-20 18:29:38 UTC) #45
danakj
On 2016/12/20 18:29:38, Wez wrote: > Yes, I'm familiar with EXPECT_DCHECK_DEATH (the latest patch-set updates ...
4 years ago (2016-12-22 19:09:35 UTC) #54
danakj
Another possibility would be to make EXPECT_DCHECK_DEATH disabled when this CL is active (windows official ...
4 years ago (2016-12-22 19:11:46 UTC) #55
gab
On 2016/12/22 19:11:46, danakj_OOO_and_slow wrote: > Another possibility would be to make EXPECT_DCHECK_DEATH disabled when ...
4 years ago (2016-12-22 20:07:07 UTC) #56
Wez
https://codereview.chromium.org/2288473002/diff/160001/third_party/WebKit/Source/wtf/Assertions.h File third_party/WebKit/Source/wtf/Assertions.h (right): https://codereview.chromium.org/2288473002/diff/160001/third_party/WebKit/Source/wtf/Assertions.h#newcode160 third_party/WebKit/Source/wtf/Assertions.h:160: #define ASSERT_NOT_REACHED() NOTREACHED() On 2016/12/20 03:16:29, esprehn wrote: > ...
3 years, 11 months ago (2017-01-07 00:18:47 UTC) #57
Wez
On 2016/12/22 20:07:07, gab wrote: > On 2016/12/22 19:11:46, danakj_OOO_and_slow wrote: > > Another possibility ...
3 years, 11 months ago (2017-01-07 00:20:37 UTC) #58
gab
On 2017/01/07 00:20:37, Wez wrote: > On 2016/12/22 20:07:07, gab wrote: > > On 2016/12/22 ...
3 years, 11 months ago (2017-01-09 18:12:20 UTC) #59
Wez
Working implementation, with passing tests (see try-bot results in crrev.com/2591583002). :) https://codereview.chromium.org/2288473002/diff/320001/base/logging.cc File base/logging.cc (right): ...
3 years, 11 months ago (2017-01-15 01:18:47 UTC) #74
Wez
+thakis: PTAL as OWNER :)
3 years, 11 months ago (2017-01-15 01:29:15 UTC) #78
Nico
https://codereview.chromium.org/2288473002/diff/360001/base/allocator/partition_allocator/partition_alloc.h File base/allocator/partition_allocator/partition_alloc.h (right): https://codereview.chromium.org/2288473002/diff/360001/base/allocator/partition_allocator/partition_alloc.h#newcode510 base/allocator/partition_allocator/partition_alloc.h:510: CHECK(size + (2 * kCookieSize) > size); You lost ...
3 years, 11 months ago (2017-01-17 13:03:41 UTC) #85
Nico
After looking at the whole patch: Why do we need a new log level for ...
3 years, 11 months ago (2017-01-17 13:06:43 UTC) #86
Wez
On 2017/01/17 13:06:43, Nico wrote: > After looking at the whole patch: Why do we ...
3 years, 11 months ago (2017-01-17 19:23:30 UTC) #87
esprehn
https://codereview.chromium.org/2288473002/diff/380001/base/allocator/partition_allocator/partition_alloc.h File base/allocator/partition_allocator/partition_alloc.h (right): https://codereview.chromium.org/2288473002/diff/380001/base/allocator/partition_allocator/partition_alloc.h#newcode510 base/allocator/partition_allocator/partition_alloc.h:510: CHECK(size + (2 * kCookieSize) > size); This makes ...
3 years, 10 months ago (2017-01-31 20:50:58 UTC) #93
danakj
https://codereview.chromium.org/2288473002/diff/380001/base/allocator/partition_allocator/partition_alloc.h File base/allocator/partition_allocator/partition_alloc.h (right): https://codereview.chromium.org/2288473002/diff/380001/base/allocator/partition_allocator/partition_alloc.h#newcode510 base/allocator/partition_allocator/partition_alloc.h:510: CHECK(size + (2 * kCookieSize) > size); On 2017/01/31 ...
3 years, 10 months ago (2017-01-31 21:45:42 UTC) #94
Wez
3 years, 10 months ago (2017-02-06 23:50:07 UTC) #99
Have updated the CL description and implemention in
https://codereview.chromium.org/1884023002/ - will finish things up there and
close this alternative implementation out for now.

https://codereview.chromium.org/2288473002/diff/380001/base/allocator/partiti...
File base/allocator/partition_allocator/partition_alloc.h (right):

https://codereview.chromium.org/2288473002/diff/380001/base/allocator/partiti...
base/allocator/partition_allocator/partition_alloc.h:510: CHECK(size + (2 *
kCookieSize) > size);
On 2017/01/31 21:45:41, danakj (slow) wrote:
> On 2017/01/31 20:50:58, esprehn wrote:
> > This makes PA slower by putting a CHECK inside here. Why is that needed?
> 
> It's inside DCHECK_IS_ON() so this should be equal to DCHECK() but also it's a
> bit odd to write it this way then.

It is important that allocations fail if the requested |size| is nonsensical.
This particular code path is only executed in DCHECK_IS_ON() builds, in which
allocations' sizes are padded out to provide space for "cookies" - the code
assumes that DCHECK will crash the browser, which is no longer the case of
DCHECK_IS_ON() but dump-on-DCHECK is also enabled.

FWIW I've already filed crbug.com/680657 for this, since PA should really be
doing a coherent sanity-check up-front, not relying on each code path happening
to sanity-check things. Similarly, it probably shouldn't pad allocations except
in actual Debug builds.

Powered by Google App Engine
This is Rietveld 408576698