-
Notifications
You must be signed in to change notification settings - Fork 37.7k
util: Make thread names shorter #16984
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, |
I was looking for two-characters string: |
Concept ACK, no opinion on "b1" specifically but having non-cropped thread names would be nice. |
ACK c442646 modulo: <bikeshedding> Making it |
@hebasto, @practicalswift What about |
|
Thread names at the process level are limited by 15 characters. This commit ensures that name 'b-httpworker.42' will not be cropped.
c442646
to
386ae0f
Compare
@promag @laanwj @practicalswift Thank you for your reviews.
Done. PR description has been updated. |
ACK 386ae0f (skimmed the diff on GitHub) |
ACK 386ae0f -- diff looks correct |
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.
ACK 386ae0f - 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
386ae0f util: Make thread names shorter (Hennadii Stepanov) Pull request description: 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 (6b2210f): ```bash 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: ```bash 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 ``` ACKs for top commit: MarcoFalke: ACK 386ae0f (skimmed the diff on GitHub) practicalswift: ACK 386ae0f -- diff looks correct fanquake: ACK 386ae0f - quickly tested on a Debian system. Tree-SHA512: 8f7f553213a5856943ddba50611814b771e7dc474101a3e1f98259091684c8d0358c541d32011bfe1da7f430225f01a2d6b514a3b7c5aaf671b2ca8fcf155c4a
Post-merge ACK |
Summary: ``` Thread names at the process level are limited by 15 characters. This commit ensures that name 'b-httpworker.42' will not be cropped. ``` Backport of core [[bitcoin/bitcoin#16984 | PR16984]]. Depends on D5540. Test Plan: ninja check bitcoind -daemon -testnet ps -T -p $(cat ~/.bitcoin/testnet3/bitcoind.pid) Check no thread name is truncated. Before: ``` PID SPID TTY TIME CMD 3749 3749 ? 00:00:07 bitcoind 3749 3750 ? 00:00:00 bitcoin-scriptc 3749 3751 ? 00:00:00 bitcoin-scriptc 3749 3752 ? 00:00:00 bitcoin-scriptc 3749 3753 ? 00:00:00 bitcoin-scriptc 3749 3754 ? 00:00:00 bitcoin-scriptc 3749 3755 ? 00:00:00 bitcoin-schedul 3749 3756 ? 00:00:00 bitcoin-http 3749 3757 ? 00:00:00 bitcoin-httpwor 3749 3758 ? 00:00:00 bitcoin-httpwor 3749 3759 ? 00:00:00 bitcoin-httpwor 3749 3760 ? 00:00:00 bitcoin-httpwor 3749 3761 ? 00:00:01 bitcoind 3749 3765 ? 00:00:00 bitcoin-torcont 3749 3766 ? 00:00:00 bitcoin-net 3749 3768 ? 00:00:00 bitcoin-addcon 3749 3769 ? 00:00:00 bitcoin-opencon 3749 3770 ? 00:00:02 bitcoin-msghand ``` After: ``` PID SPID TTY TIME CMD 5191 5191 ? 00:00:06 b-init 5191 5192 ? 00:00:00 b-scriptch.0 5191 5193 ? 00:00:00 b-scriptch.1 5191 5194 ? 00:00:00 b-scriptch.2 5191 5195 ? 00:00:00 b-scriptch.3 5191 5196 ? 00:00:00 b-scriptch.4 5191 5197 ? 00:00:00 b-scheduler 5191 5198 ? 00:00:00 b-http 5191 5199 ? 00:00:00 b-httpworker.0 5191 5200 ? 00:00:00 b-httpworker.1 5191 5201 ? 00:00:00 b-httpworker.2 5191 5202 ? 00:00:00 b-httpworker.3 5191 5206 ? 00:00:00 b-torcontrol 5191 5207 ? 00:00:00 b-net 5191 5208 ? 00:00:00 b-dnsseed 5191 5209 ? 00:00:00 b-addcon 5191 5210 ? 00:00:00 b-opencon 5191 5211 ? 00:00:00 b-msghand ``` Reviewers: #bitcoin_abc, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D5543
Thread names in logs and deadlock debug tools See merge request bitcoin-cash-node/bitcoin-cash-node!834 This is a backport of [PR15849](bitcoin/bitcoin#15849) (Thread names in logs and deadlock debug tools). See original PR for benchmarks. Also includes some smaller follow-up PR's: * [PR15968](bitcoin/bitcoin#15968) - Fix portability issue with pthreads * [PR16984](bitcoin/bitcoin#16984) - util: Make thread names shorter * [PR17038](bitcoin/bitcoin#17038) - Don't rename main thread at process level ## Test plan New tests: `ninja check` Run with `-logthreadnames`, observe lines are prefixed with thread ``` 2020-10-28T11:39:16Z [init] init message: Done loading 2020-10-28T11:39:16Z [opencon] opencon thread start 2020-10-28T11:39:16Z [dnsseed] 0 addresses found from DNS seeds 2020-10-28T11:39:16Z [msghand] msghand thread start 2020-10-28T11:39:16Z [dnsseed] dnsseed thread exit ``` Compile with lockorder debugging enabled: `cmake -GNinja -DCMAKE_BUILD_TYPE=Debug ..`
merge bitcoin#15928...bitcoin#16984: backports
Thread names at the process level are limited by 15 characters:
bitcoin/src/util/threadnames.cpp
Lines 28 to 29 in 6b2210f
This commit ensures that name
b-httpworker.42
will not be truncated.On master (6b2210f):
With this PR: