`-par` command line option, script threads reporting off-by-one? #7799

issue laanwj opened this issue on April 3, 2016
  1. laanwj commented at 12:44 PM on April 3, 2016: member

    This message is wrong, it reports one thread too many:

    2016-04-03 12:37:54 Using 4 threads for script verification
    

    The appropriate code is:

        LogPrintf("Using %u threads for script verification\n", nScriptCheckThreads);
        if (nScriptCheckThreads) {
            for (int i=0; i<nScriptCheckThreads-1; i++)
                threadGroup.create_thread(&ThreadScriptCheck);
        }
    

    Also -par directly sets nScriptCheckThreads,

    nScriptCheckThreads = GetArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
    

    so this means the option help is also incorrect:

      -par=<n>
           Set the number of script verification threads
    

    What is the desired, expected behavior here?

    (or is the thread that dispatches the work to script threads also counted as a 'verification' thread? we probably should document this, then, I spent some time on a wild goose chase for a missing ghost thread in htop)

  2. laanwj added the label Validation on Apr 3, 2016
  3. laanwj renamed this:
    `-par` command line option, script threads reporting
    `-par` command line option, script threads reporting off-by-one?
    on Apr 3, 2016
  4. sipa commented at 12:46 PM on April 3, 2016: member

    Yes, it's counting the message processing thread as well, as it switches to signature validation once all to-be-checked ssignatures are pushed to the validation queue.

    That's why -par=1 is consistent with "no parallellism".

    Do you think there is a better way to report this?

  5. laanwj commented at 12:53 PM on April 3, 2016: member

    That's why -par=1 is consistent with "no parallellism".

    Sure, but I thought that was a special case where all validation was done in the main thread. As soon as there are threads, I thought no validation work was done anymore in the main thread. Apparantly I was wrong.

    No, I think this is fine, closing.

  6. laanwj closed this on Apr 3, 2016

  7. DrahtBot locked this on Sep 8, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me