Skip to content

Commit 6e4f655

Browse files
committed
Merge #16984: util: Make thread names shorter
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
2 parents 9dd99ea + 386ae0f commit 6e4f655

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/threadnames.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ static void SetInternalName(std::string name) { }
5757

5858
void util::ThreadRename(std::string&& name)
5959
{
60-
SetThreadName(("bitcoin-" + name).c_str());
60+
SetThreadName(("b-" + name).c_str());
6161
SetInternalName(std::move(name));
6262
}

0 commit comments

Comments
 (0)