logging: fix logging empty thread name #25256

pull klementtan wants to merge 1 commits into bitcoin:master from klementtan:add_leveldb_threadname changing 1 files +2 −1
  1. klementtan commented at 3:47 pm on May 31, 2022: contributor

    Currently, leveldb background thread does not have a thread name and as a result, an empty thread name is logged.

    This PR fixes this by logging thread name as "unknown" if the thread name is empty

    On master:

    02022-06-02T14:30:38Z [] [leveldb:debug] Generated table [#281](/bitcoin-bitcoin/281/)@0: 1862 keys, 138303 bytes
    

    On this PR:

    02022-06-02T14:30:38Z [unknown] [leveldb:debug] Generated table [#281](/bitcoin-bitcoin/281/)@0: 1862 keys, 138303 bytes
    
  2. in src/leveldb/util/env_posix.cc:803 in a97de2ccc5 outdated
    799@@ -799,7 +800,9 @@ void PosixEnv::Schedule(
    800   // Start the background thread, if we haven't done so already.
    801   if (!started_background_thread_) {
    802     started_background_thread_ = true;
    803-    std::thread background_thread(PosixEnv::BackgroundThreadEntryPoint, this);
    804+    std::thread background_thread(&util::TraceThread, "leveldb", [this] {
    


    laanwj commented at 3:51 pm on May 31, 2022:
    I’m not sure what would be a good way to do this, but we shouldn’t make changes to upstream leveldb here.

    klementtan commented at 5:17 pm on May 31, 2022:
    Agreed, remove the commit that modifies leveldb.
  3. DrahtBot added the label Upstream on May 31, 2022
  4. DrahtBot added the label Utils/log/libs on May 31, 2022
  5. DrahtBot added the label UTXO Db and Indexes on May 31, 2022
  6. laanwj removed the label UTXO Db and Indexes on May 31, 2022
  7. jonatack commented at 5:03 pm on May 31, 2022: member
    @klementtan do you wish to add the configuration option and logging RPC option to change the default log severity level? I haven’t done that yet in #25203 and have been moving forward on the basis that the default level will be info.
  8. klementtan force-pushed on May 31, 2022
  9. klementtan renamed this:
    logging: Add leveldb thread name and fix logging empty thread name
    logging: fix logging empty thread name
    on May 31, 2022
  10. klementtan commented at 5:39 pm on May 31, 2022: contributor

    @klementtan do you wish to add the configuration option and logging RPC option to change the default log severity level? @jonatack my apologies for the delay. I was busy these few days and am planning to make a PR for it by this weekend.

    have been moving forward on the basis that the default level will be info.

    Yes, I am planning on setting the minimum log level to Info.

  11. hebasto commented at 7:04 pm on May 31, 2022: member

    On master:

    02022-05-31T15:44:41Z [] [leveldb:debug] Generated table [#223](/bitcoin-bitcoin/223/)@0: 18859 keys, 1502400 bytes
    

    On this PR:

    02022-05-31T17:16:16Z [leveldb:debug] Generated table [#268](/bitcoin-bitcoin/268/)@1: 27047 keys, 2150932 bytes
    

    Concept ~0.

    The example above creates a false view as if leveldb’s thread has name “leveldb:debug”.

  12. laanwj commented at 6:28 am on June 1, 2022: member

    The example above creates a false view as if leveldb’s thread has name “leveldb:debug”.

    I agree, this makes parsing more of a hassle. Maybe we can log something like [unknown] or [-] for unknown thread names?

    Edit: alternatively, log the thread id instead, but this may be platform specific hassle.

  13. MarcoFalke removed the label Upstream on Jun 1, 2022
  14. logging: fix logging empty threadname 3a171f742c
  15. klementtan force-pushed on Jun 2, 2022
  16. klementtan commented at 2:32 pm on June 2, 2022: contributor
    @hebasto @laanwj Thanks for the feedback! Updated the PR to log thread name as "unknown" instead.
  17. laanwj commented at 3:22 pm on June 2, 2022: member
    Code review ACK 3a171f742c31addf5a343e8a6905054a1fbb12aa
  18. hebasto approved
  19. hebasto commented at 5:52 pm on June 2, 2022: member

    ACK 3a171f742c31addf5a343e8a6905054a1fbb12aa

    PR description seems messed about master/PR:

    On master:

    02022-06-02T14:30:38Z [unknown] [leveldb:debug] Generated table [#281](/bitcoin-bitcoin/281/)@0: 1862 keys, 138303 bytes
    

    On this PR:

    02022-05-31T17:16:16Z [leveldb:debug] Generated table [#268](/bitcoin-bitcoin/268/)@1: 27047 keys, 2150932 bytes
    

    and should be updated before merging.

  20. MarcoFalke merged this on Jun 3, 2022
  21. MarcoFalke closed this on Jun 3, 2022

  22. sidhujag referenced this in commit ac309040e2 on Jun 3, 2022
  23. klementtan deleted the branch on Jun 23, 2022
  24. DrahtBot locked this on Jun 23, 2023

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: 2025-01-15 12:12 UTC

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