Skip to content

Conversation

ajtowns
Copy link
Contributor

@ajtowns ajtowns commented Oct 9, 2021

Moves the following log messages into debug log categories:

  • "AcceptBlockHeader: ..." to validation
  • "Prune: deleted blk/rev" to new blockstorage log category
  • "Leaving block file" moves from validation to blockstorage
  • "write coins cache to disk" to bench

Also adds the hash of the block to the log message when AcceptBlockHeader is rejecting because of problems with the prev block.

@ajtowns
Copy link
Contributor Author

ajtowns commented Oct 9, 2021

Inspired by an irc complaint the other day about a ContextualCheckBlockHeader log message about a bad-diffbits failure for block 000000000000000000639be19a0123a1c99d9fef89f0b8ac055a77f4ef86ae3b which is BCH block at height 478577 from Aug 2017.

This might resolve issue #17421

@practicalswift
Copy link
Contributor

Very Strong Concept ACK

We still do too much unconditional logging IMO: it is spammy (low signal-to-noise) and potentially dangerous (see disk fill attack scenarios described in #21559).

Thanks a lot for improving the situation! :)

I'm willing to review any PR that improves the logging situation by thoughtfully moving unconditional logging (LogPrintf(…)) to conditional logging (LogPrint(CATEGORY, …): feel free to ping me in to such PRs for speedy review! :)

FWIW:

$ git grep 'LogPrintf(' -- "*.cpp" "*.h" | wc -l
493

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 9, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #22956 (validation: log CChainState::CheckBlockIndex() consistency checks by jonatack)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@maflcko
Copy link
Member

maflcko commented Oct 11, 2021

                                     File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/rpc_misc.py", line 60, in run_test
                                       assert_equal(len(node.logging()), 26)
                                     File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 50, in assert_equal
                                       raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
                                   AssertionError: not(27 == 26)

@ajtowns ajtowns force-pushed the 202110-acceptblockheader-silence branch from 8af3c18 to b5950dd Compare October 11, 2021 12:08
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK b5950dd.

@@ -3205,7 +3205,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
if (ppindex)
*ppindex = pindex;
if (pindex->nStatus & BLOCK_FAILED_MASK) {
LogPrintf("ERROR: %s: block %s is marked invalid\n", __func__, hash.ToString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

da94ebc

nit, not sure if this change (commit) merits a release note.

@practicalswift
Copy link
Contributor

cr ACK b5950dd

@Empact
Copy link
Contributor

Empact commented Oct 13, 2021

Code review ACK b5950dd

@laanwj
Copy link
Member

laanwj commented Oct 13, 2021

Code review ACK b5950dd

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK b5950dd

@meshcollider meshcollider merged commit ec4e43c into bitcoin:master Oct 14, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 14, 2021
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 23, 2022
…rors

Summary:
This is a backport of [[bitcoin/bitcoin#23235 | core#23235]] [1/4]
bitcoin/bitcoin@1d7d835

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12038
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 23, 2022
…category

Summary:
This is a backport of [[bitcoin/bitcoin#23235 | core#23235]] [2/4]
bitcoin/bitcoin@da94ebc

Depends on D12038

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12039
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 23, 2022
Summary:
This is a backport of [[bitcoin/bitcoin#23235 | core#23235]] [3/4]
bitcoin/bitcoin@31b2b80

Depends on D12039, D12040 and D12041

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12042
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 23, 2022
Summary:
This is a backport of [[bitcoin/bitcoin#23235 | core#23235]] [4/4]
bitcoin/bitcoin@b5950dd

Depends on D12042

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12043
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants