util: Make thread names shorter #16984

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20190929-short-thread-names changing 1 files +1 −1
  1. hebasto commented at 7:05 PM on September 29, 2019: member

    Thread names at the process level are limited by 15 characters: https://github.com/bitcoin/bitcoin/blob/6b2210f1016c9ed96ce470e588e4cb12fa36a900/src/util/threadnames.cpp#L28-L29

    This commit ensures that name b-httpworker.42 will not be truncated.

    On master (6b2210f1016c9ed96ce470e588e4cb12fa36a900):

    hebasto@redcat:~$ ps -T -p $(cat /home/hebasto/.bitcoin/testnet3/bitcoind.pid)
      PID  SPID TTY          TIME CMD
    32647 32647 pts/6    00:00:00 bitcoin-main
    32647 32648 pts/6    00:00:00 QXcbEventReader
    32647 32649 pts/6    00:00:00 bitcoin:disk$0
    32647 32650 pts/6    00:00:00 QDBusConnection
    32647 32651 pts/6    00:00:00 gmain
    32647 32652 pts/6    00:00:00 gdbus
    32647 32653 pts/6    00:00:07 bitcoin-qt-init
    32647 32656 pts/6    00:00:00 bitcoin-scriptc
    32647 32657 pts/6    00:00:00 bitcoin-scriptc
    32647 32658 pts/6    00:00:00 bitcoin-scriptc
    32647 32659 pts/6    00:00:00 bitcoin-schedul
    32647 32660 pts/6    00:00:00 bitcoin-http
    32647 32661 pts/6    00:00:00 bitcoin-httpwor
    32647 32662 pts/6    00:00:00 bitcoin-httpwor
    32647 32663 pts/6    00:00:00 bitcoin-httpwor
    32647 32664 pts/6    00:00:00 bitcoin-httpwor
    32647 32665 pts/6    00:00:00 bitcoin-qt-init
    32647 32668 pts/6    00:00:00 bitcoin-torcont
    32647 32669 pts/6    00:00:00 bitcoin-upnp
    32647 32670 pts/6    00:00:00 bitcoin-net
    32647 32671 pts/6    00:00:00 bitcoin-dnsseed
    32647 32672 pts/6    00:00:00 bitcoin-addcon
    32647 32673 pts/6    00:00:00 bitcoin-opencon
    32647 32674 pts/6    00:00:00 bitcoin-msghand
    32647 32675 pts/6    00:00:00 QThread
    32647 32676 pts/6    00:00:00 QThread
    

    With this PR:

    hebasto@redcat:~$ ps -T -p $(cat /home/hebasto/.bitcoin/testnet3/bitcoind.pid)
      PID  SPID TTY          TIME CMD
    25664 25664 pts/0    00:00:00 b-main
    25664 25665 pts/0    00:00:00 QXcbEventReader
    25664 25666 pts/0    00:00:00 bitcoin:disk$0
    25664 25667 pts/0    00:00:00 QDBusConnection
    25664 25668 pts/0    00:00:00 gmain
    25664 25669 pts/0    00:00:00 gdbus
    25664 25670 pts/0    00:00:07 b-qt-init
    25664 25671 pts/0    00:00:00 b-scriptch.0
    25664 25672 pts/0    00:00:00 b-scriptch.1
    25664 25673 pts/0    00:00:00 b-scriptch.2
    25664 25674 pts/0    00:00:00 b-scheduler
    25664 25675 pts/0    00:00:00 b-http
    25664 25676 pts/0    00:00:00 b-httpworker.0
    25664 25677 pts/0    00:00:00 b-httpworker.1
    25664 25678 pts/0    00:00:00 b-httpworker.2
    25664 25679 pts/0    00:00:00 b-httpworker.3
    25664 25680 pts/0    00:00:00 b-qt-init
    25664 25682 pts/0    00:00:00 b-torcontrol
    25664 25683 pts/0    00:00:00 b-upnp
    25664 25684 pts/0    00:00:00 b-net
    25664 25685 pts/0    00:00:00 b-dnsseed
    25664 25686 pts/0    00:00:00 b-addcon
    25664 25687 pts/0    00:00:00 b-opencon
    25664 25688 pts/0    00:00:01 b-msghand
    25664 25689 pts/0    00:00:00 QThread
    25664 25690 pts/0    00:00:00 QThread
    
  2. DrahtBot added the label Utils/log/libs on Sep 29, 2019
  3. promag commented at 9:00 PM on September 29, 2019: member

    Concept ACK, b1?

  4. fanquake requested review from jamesob on Sep 29, 2019
  5. hebasto commented at 5:15 AM on September 30, 2019: member

    b1?

    I was looking for two-characters string: b points to Bitcoin, and 1 is a distinct separator.

  6. laanwj commented at 7:16 AM on September 30, 2019: member

    Concept ACK, no opinion on "b1" specifically but having non-cropped thread names would be nice.

  7. practicalswift commented at 9:09 AM on September 30, 2019: contributor

    ACK c442646be76ef3ba8015781aebb0e55ab742e3c9 modulo:

    <bikeshedding> I find say b1scheduler a bit unpleasant to read -- 1 looks a bit like l or I. Perhaps - is better as a separator?

    Making it b-scheduler instead of b1scheduler :) </bikeshedding>

  8. yusufsahinhamza commented at 9:15 AM on September 30, 2019: contributor

    @hebasto, @practicalswift What about btc instead of b1?

  9. hebasto commented at 9:27 AM on September 30, 2019: member

    What about btc instead of b1?

    btc length is 3 characters. It will require to make shorter other parts of thread name, e.g., httpworker

  10. util: Make thread names shorter
    Thread names at the process level are limited by 15 characters. This
    commit ensures that name 'b-httpworker.42' will not be cropped.
    386ae0f691
  11. hebasto force-pushed on Sep 30, 2019
  12. hebasto commented at 7:38 PM on September 30, 2019: member

    @promag @laanwj @practicalswift Thank you for your reviews.

    I find say b1scheduler a bit unpleasant to read -- 1 looks a bit like l or I. Perhaps - is better as a separator? Making it b-scheduler instead of b1scheduler :)

    Done. PR description has been updated.

  13. MarcoFalke commented at 8:09 PM on September 30, 2019: member

    ACK 386ae0f6916d11d72022cc6f6b62bb2b82594f24 (skimmed the diff on GitHub)

  14. practicalswift commented at 9:02 PM on September 30, 2019: contributor

    ACK 386ae0f6916d11d72022cc6f6b62bb2b82594f24 -- diff looks correct

  15. fanquake approved
  16. fanquake commented at 4:23 AM on October 1, 2019: member

    ACK 386ae0f6916d11d72022cc6f6b62bb2b82594f24 - quickly tested on a Debian system.

    ps -T -p $(cat /home/test/regtest/bitcoind.pid)
      PID  SPID TTY          TIME CMD
     5909  5909 ?        00:00:00 b-init
     5909  5910 ?        00:00:00 b-scriptch.0
     5909  5911 ?        00:00:00 b-scriptch.1
     5909  5912 ?        00:00:00 b-scriptch.2
     5909  5913 ?        00:00:00 b-scriptch.3
     5909  5914 ?        00:00:00 b-scheduler
     5909  5915 ?        00:00:00 b-http
     5909  5916 ?        00:00:00 b-httpworker.0
     5909  5917 ?        00:00:00 b-httpworker.1
     5909  5918 ?        00:00:00 b-httpworker.2
     5909  5919 ?        00:00:00 b-httpworker.3
     5909  5921 ?        00:00:00 b-torcontrol
     5909  5922 ?        00:00:00 b-net
     5909  5924 ?        00:00:00 b-addcon
     5909  5925 ?        00:00:00 b-opencon
     5909  5926 ?        00:00:00 b-msghand
    
  17. fanquake referenced this in commit 6e4f655391 on Oct 1, 2019
  18. fanquake merged this on Oct 1, 2019
  19. fanquake closed this on Oct 1, 2019

  20. jamesob commented at 1:38 PM on October 1, 2019: member

    Post-merge ACK

  21. hebasto deleted the branch on Oct 1, 2019
  22. deadalnix referenced this in commit 1232b0292c on Mar 24, 2020
  23. ftrader referenced this in commit 2ac5ab36d5 on Dec 1, 2020
  24. kittywhiskers referenced this in commit 452c26e390 on Nov 6, 2021
  25. kittywhiskers referenced this in commit 2ddfa2ec21 on Dec 5, 2021
  26. kittywhiskers referenced this in commit 0d3bc6f060 on Dec 5, 2021
  27. kittywhiskers referenced this in commit 6ef0ef65e3 on Dec 12, 2021
  28. kittywhiskers referenced this in commit 502a329214 on Dec 12, 2021
  29. kittywhiskers referenced this in commit adc3f0478c on Dec 12, 2021
  30. PastaPastaPasta referenced this in commit a7f5379e19 on Dec 12, 2021
  31. DrahtBot locked this on Dec 16, 2021

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-05-03 18:14 UTC

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