Problem
Linux limits thread names set through PR_SET_NAME to 15 visible bytes:
The name can be up to 16 bytes long, including the terminating null byte.
Bitcoin Core prefixes system thread names with b-, leaving only 13 bytes for the thread-specific part.
This truncates longer indexer names in system tools, for example b-coinstatsindex and b-txospenderindex.
It also makes verbose worker suffixes like b-http_pool_N spend much of the available space; the current HTTP worker names fit, but the generic suffix leaves less room for longer pool names.
The same limit is documented in the existing thread-name helper: https://github.com/bitcoin/bitcoin/blob/8b49e2dd4eed93d08a3d9681d444aaf441ab0037/src/util/threadnames.cpp#L25
This was noticed during review of #31132 (review)
Fix
Shorten the thread names passed to TraceThread while keeping public index identifiers unchanged.
ThreadPool workers now uniformly use a dotted numeric suffix, so HTTP workers are named like b-http.0.
Indexer sync threads now pass display and thread names separately at each BaseIndex call site.
The current indexer thread names use compact idx-suffixed names that fit within the Linux limit after the b- prefix:
txindex -> txidx
basic block filter index -> blkfltbscidx
coinstatsindex -> coinstatsidx
txospenderindex -> txospenderidx
Indexer display names, getindexinfo keys, command-line options, and on-disk index paths are unchanged.
Testing
See https://godbolt.org/z/oWonrTKcj for a simple reproducer.
Alternatively, start bitcoind on Linux with the affected indexes enabled and read the kernel-visible thread names.
Before this change, the relevant names were truncated or used longer forms:
b-txindex
b-basic block f
b-coinstatsinde
b-http_pool_15
b-txospenderind
After this change, the same check shows compact, untruncated names:
b-txidx
b-blkfltbscidx
b-coinstatsidx
b-http.15
b-txospenderidx