-
Notifications
You must be signed in to change notification settings - Fork 37.7k
log: Fix log message for -par=1 #17325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Concept ACK |
src/init.cpp
Outdated
for (int i=0; i<nScriptCheckThreads-1; i++) | ||
threadGroup.create_thread([i]() { return ThreadScriptCheck(i); }); | ||
} else { | ||
LogPrintf("Using the only thread for script verification\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK, my only comment would be that , but log different messages.-par=0
and -par=1
do the same thing (right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly:
Line 380 in 08e2947
gArgs.AddArg("-par=<n>", strprintf("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, I'm not really talking about the input argument, but the already-processed value we end up with here.
It's doing the same thing in case of nScriptCheckThreads==0
and nScriptCheckThreads==1
so should log the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this code
Lines 1064 to 1071 in 08e2947
// -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency | |
nScriptCheckThreads = gArgs.GetArg("-par", DEFAULT_SCRIPTCHECK_THREADS); | |
if (nScriptCheckThreads <= 0) | |
nScriptCheckThreads += GetNumCores(); | |
if (nScriptCheckThreads <= 1) | |
nScriptCheckThreads = 0; | |
else if (nScriptCheckThreads > MAX_SCRIPTCHECK_THREADS) | |
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS; |
is executed in AppInitParameterInteraction()
, nScriptCheckThreads==1
is an impossible value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so it will never log Using 1 threads concurrently for script verification
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
src/init.cpp
Outdated
for (int i=0; i<nScriptCheckThreads-1; i++) | ||
threadGroup.create_thread([i]() { return ThreadScriptCheck(i); }); | ||
} else { | ||
LogPrintf("Using the only thread for script verification\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something feels a bit off with the wording here. What about "Using one thread for script verification"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not just any thread though, it's the main thread. No additional threads are spawned. I think that's what he's trying to convey.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
"Validation concurrency disabled: using the main thread for script validation."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the thread:
Line 1267 in feb1a8c
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop)); |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That spawns the scheduler thread, which is unrelated to script verification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On -par=1
, it will inline the calls into the current thread. See also:
git grep '\-par=' test
src/init.cpp
Outdated
for (int i=0; i<nScriptCheckThreads-1; i++) | ||
threadGroup.create_thread([i]() { return ThreadScriptCheck(i); }); | ||
} else { | ||
LogPrintf("Using the only thread for script verification\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LogPrintf("Using the only thread for script verification\n"); | |
LogPrintf("Script verification is done in the main thread\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But script verification is always done in the main thread (as well), the other threads are only additional 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Script verification is done in the main thread only (no validation concurrency)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or "Script verification uses N additional threads" where N can be 0… it doesn't have to be a whole story
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's make it a one-line "fix"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shortest would be
LogPrintf("Script verification uses %d additional threads\m", std::max(nScriptCheckThreads-1, 0));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, it is shorter than conditional operator ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be nScriptCheckThreads-1
. nScriptCheckThreads
is the number of threads that are dedicated to script checking, so:
ifnScriptCheckThreads
>= 2, then log "Script verification uses {nScriptCheckThreads} additional threads"ifnScriptCheckThreads
== 0, then script checking is done on the main thread so log "Script verification uses 0 additional threads"nScriptCheckThreads
cannot == 1 because of the logic in init.cpp
so you just want:
LogPrintf("Script verification uses %d dedicated threads\m", nScriptCheckThreads);
The log is already essentially correct. I think you just need to add the word 'dedicated' or 'additional' (I prefer 'dedicated').
@sipa has corrected my misunderstanding below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not correct; it should be LogPrintf("Script verification uses %d dedicated threads\m", nScriptCheckThreads - 1);
then, as nScriptCheckThreads
includes the main thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sipa The std::max(nScriptCheckThreads-1, 0)
bound is there because nScriptCheckThreads might be zero at this point.
3ee5d33
to
417c910
Compare
Co-authored-by: Wladimir J. van der Laan <laanwj@protonmail.com>
417c910
to
8a0ca5e
Compare
All comments have been addressed. |
Tested ACK 8a0ca5e If we wanted to be completely explicit we could log "Script verification uses main thread and %d dedicated threads\n" |
ACK 8a0ca5e
I know bitcoin core is lacking in user documentation, but I don't think the debug log is the place for it 😄 |
8a0ca5e log: Fix log message for -par=1 (Hennadii Stepanov) Pull request description: Fix #17139 ACKs for top commit: jnewbery: Tested ACK 8a0ca5e laanwj: ACK 8a0ca5e Tree-SHA512: 09f5416c00cd3e4f85cd9040267dc825d5c5623f8903e9d2373013686dce7f6b3ba573648787adc1d58e6f1d5012e26c78700d585273d4b508cb25312b3fa06b
8a0ca5e log: Fix log message for -par=1 (Hennadii Stepanov) Pull request description: Fix bitcoin#17139 ACKs for top commit: jnewbery: Tested ACK 8a0ca5e laanwj: ACK 8a0ca5e Tree-SHA512: 09f5416c00cd3e4f85cd9040267dc825d5c5623f8903e9d2373013686dce7f6b3ba573648787adc1d58e6f1d5012e26c78700d585273d4b508cb25312b3fa06b
- doc: fix git add argument bitcoin#18513 - build: Fix libevent linking for bench_bitcoin binary bitcoin#18397 - script: fix SCRIPT_ERR_SIG_PUSHONLY error string bitcoin#18412 - doc: Comment fix merkle.cpp bitcoin#18379 - log: Fix UB with bench on genesis block bitcoin#15283 - test: Fix mining to an invalid target + ensure that a new block has the correct hash internally bitcoin#18350 - Fix missing header in sync.h bitcoin#18357 - refactor: Fix implicit value conversion in formatPingTime bitcoin#18260 - Fix .gitignore policy in build_msvc directory bitcoin#18108 - build: Fix behavior when ALLOW_HOST_PACKAGES unset bitcoin#18051 - test: Fix p2p_invalid_messages failing in Python 3.8 because of warning bitcoin#17931 - qa: Fix double-negative arg test bitcoin#17893 - build: Fix configure report about qr bitcoin#17547 - log: Fix log message for -par=1 bitcoin#17325 - bench: Fix negative values and zero for -evals flag bitcoin#17267 - depends: fix boost mac cross build with clang 9+ bitcoin#17231 - doc: Fix broken bitcoin-cli examples bitcoin#17119 - doc: fix Makefile target in benchmarking.md bitcoin#17081 - contrib: fix minor typos in makeseeds.py bitcoin#17042 - test: Fix Python Docstring to include all Args. bitcoin#17030 - doc: Fix some misspellings bitcoin#17351 - doc: Doxygen-friendly script/descriptor.h comments bitcoin#16947 - doc: Fix doxygen errors bitcoin#17945 - doc: Doxygen-friendly CuckooCache comments bitcoin#16986 - doc: Add to Doxygen documentation guidelines bitcoin#17873
- doc: fix git add argument bitcoin#18513 - build: Fix libevent linking for bench_bitcoin binary bitcoin#18397 - script: fix SCRIPT_ERR_SIG_PUSHONLY error string bitcoin#18412 - doc: Comment fix merkle.cpp bitcoin#18379 - log: Fix UB with bench on genesis block bitcoin#15283 - test: Fix mining to an invalid target + ensure that a new block has the correct hash internally bitcoin#18350 - Fix missing header in sync.h bitcoin#18357 - refactor: Fix implicit value conversion in formatPingTime bitcoin#18260 - Fix .gitignore policy in build_msvc directory bitcoin#18108 - build: Fix behavior when ALLOW_HOST_PACKAGES unset bitcoin#18051 - test: Fix p2p_invalid_messages failing in Python 3.8 because of warning bitcoin#17931 - qa: Fix double-negative arg test bitcoin#17893 - build: Fix configure report about qr bitcoin#17547 - log: Fix log message for -par=1 bitcoin#17325 - bench: Fix negative values and zero for -evals flag bitcoin#17267 - depends: fix boost mac cross build with clang 9+ bitcoin#17231 - doc: Fix broken bitcoin-cli examples bitcoin#17119 - doc: fix Makefile target in benchmarking.md bitcoin#17081 - contrib: fix minor typos in makeseeds.py bitcoin#17042 - test: Fix Python Docstring to include all Args. bitcoin#17030 - doc: Fix some misspellings bitcoin#17351 - doc: Doxygen-friendly script/descriptor.h comments bitcoin#16947 - doc: Fix doxygen errors bitcoin#17945 - doc: Doxygen-friendly CuckooCache comments bitcoin#16986 - doc: Add to Doxygen documentation guidelines bitcoin#17873 - depends: Consistent use of package variable bitcoin#17928 - init: Replace URL_WEBSITE with PACKAGE_URL bitcoin#18503 - doc: Add missed copyright headers bitcoin#17691
8a0ca5e log: Fix log message for -par=1 (Hennadii Stepanov) Pull request description: Fix bitcoin#17139 ACKs for top commit: jnewbery: Tested ACK 8a0ca5e laanwj: ACK 8a0ca5e Tree-SHA512: 09f5416c00cd3e4f85cd9040267dc825d5c5623f8903e9d2373013686dce7f6b3ba573648787adc1d58e6f1d5012e26c78700d585273d4b508cb25312b3fa06b
8a0ca5e log: Fix log message for -par=1 (Hennadii Stepanov) Pull request description: Fix bitcoin#17139 ACKs for top commit: jnewbery: Tested ACK 8a0ca5e laanwj: ACK 8a0ca5e Tree-SHA512: 09f5416c00cd3e4f85cd9040267dc825d5c5623f8903e9d2373013686dce7f6b3ba573648787adc1d58e6f1d5012e26c78700d585273d4b508cb25312b3fa06b
8a0ca5e log: Fix log message for -par=1 (Hennadii Stepanov) Pull request description: Fix bitcoin#17139 ACKs for top commit: jnewbery: Tested ACK 8a0ca5e laanwj: ACK 8a0ca5e Tree-SHA512: 09f5416c00cd3e4f85cd9040267dc825d5c5623f8903e9d2373013686dce7f6b3ba573648787adc1d58e6f1d5012e26c78700d585273d4b508cb25312b3fa06b
8a0ca5e log: Fix log message for -par=1 (Hennadii Stepanov) Pull request description: Fix bitcoin#17139 ACKs for top commit: jnewbery: Tested ACK 8a0ca5e laanwj: ACK 8a0ca5e Tree-SHA512: 09f5416c00cd3e4f85cd9040267dc825d5c5623f8903e9d2373013686dce7f6b3ba573648787adc1d58e6f1d5012e26c78700d585273d4b508cb25312b3fa06b
Fix #17139