Skip to content

Conversation

@laanwj
Copy link
Member

@laanwj laanwj commented Apr 3, 2016

Avoid logging two or more lines per block in UpdateTip by adding the (optional) warning into the UpdateTip log message.

Before:

2016-04-03 11:09:21 UpdateTip: new best=000000000000000004de55677b9b01d5bb105a6c93e76efca2fa40d6281614db height=405532 version=0x00000004 log2_work=84.416823 tx=119994369 date='2016-04-03 11:09:01' progress=1.000000 cache=1759.4MiB(1793826tx)
2016-04-03 11:09:21 UpdateTip: 7 of last 100 blocks have unexpected version

After:

2016-04-03 11:09:23 UpdateTip: new best=000000000000000004de55677b9b01d5bb105a6c93e76efca2fa40d6281614db height=405532 version=0x00000004 log2_work=84.416823 tx=119994369 date='2016-04-03 11:09:01' progress=1.000000 cache=25.5MiB(7394tx) warning='7 of last 100 blocks have unexpected version'

@paveljanik
Copy link
Contributor

Does your fix mean that the debug log can miss some of the previously logged lines now, because only one warning is printed?

src/main.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

When you are touching this part, can you please also move this comment about 100 blocks just over the for cycle checking these 100 blocks?

Edit: the questions is, how often such case can happen, if it all...

@paveljanik
Copy link
Contributor

Concept ACK, less lines, more informations on line line, great!

@jonasschnelli
Copy link
Contributor

utACK 5553b1dc3654b5aec6a6161d867f93b1509d3379 modulo @paveljanik's nit.

@laanwj
Copy link
Member Author

laanwj commented Apr 5, 2016

Does your fix mean that the debug log can miss some of the previously logged lines now, because only one warning is printed?

Well there are two sources of warning:

  • BIP9 version bits ("unknown new rules are about to activate (versionbit %i)")
  • Old softfork mechanism ("%d of last 100 blocks have unexpected version")

I'm not sure it makes sense to ever have both, but I could accumulate the warnings instead of replacing them, sure.

Edit: OH wait, the first warning can trigger multiple times, potential for every bit. Yes I certainly need to do this.

Avoid logging two or more lines per block in UpdateTip by
adding the warning into the UpdateTip log message.
@laanwj laanwj force-pushed the 2016_04_block_warning_logging_inline branch from 5553b1d to f20d42e Compare April 5, 2016 14:38
@laanwj
Copy link
Member Author

laanwj commented Apr 5, 2016

Ok, fixed both of @paveljanik 's nits. Warnings are now collected and moved the comment.

@paveljanik
Copy link
Contributor

Thanks. (I haven't had the time to investigate myself but had the feeling, that it could be as you said).

ACK f20d42e

@gmaxwell
Copy link
Contributor

utACK.

Are LogPrintF's that are composed across multiple lines instead of in a single logprint more likely to get torn by logprints from other threads? Should the field potentially be named "warnings" since it can contain more than one?

@paveljanik
Copy link
Contributor

Can we move this forward?

@sipa
Copy link
Member

sipa commented May 25, 2016

utACK f20d42e

@sipa sipa merged commit f20d42e into bitcoin:master May 25, 2016
sipa added a commit that referenced this pull request May 25, 2016
f20d42e UpdateTip: log only one line at most per block (Wladimir J. van der Laan)
codablock pushed a commit to codablock/dash that referenced this pull request Dec 21, 2017
f20d42e UpdateTip: log only one line at most per block (Wladimir J. van der Laan)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants