- When aiming for glibc compatibility, don't use thread_local. Fixes #15958.
- FreeBSD has a buggy thread_local, don't use it. Fixes #16055.
I've done a Gitian build on my local machine and the symbol tests seem to pass.
ACK 3b549f4aae9bc5f5f9e9dee8476523daf44dd7ee (checked diff with --ignore-all-space, and verified that thread_local is now disabled on freebsd)
<details><summary>Show signature and timestamp</summary>
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK 3b549f4aae9bc5f5f9e9dee8476523daf44dd7ee (checked diff with --ignore-all-space, and verified that thread_local is now disabled on freebsd)
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhhlwwAp1D8oI5zuBCaduML4SFgcShnTo6EeWUN6VrVQDj0Ja4d2iEvgog3iJP1
+KMwj0frmEKmoBxOSW3b72iTPRWT/TeYXgp/PgqAIvy8E+K6CCIdDyBY+c/2iZTc
PSN/GnDkHGNhJ8Cx+RCgB4Io6/df+44XgpvLNzBrFeLkuZhSE0RuzzwIG9NJ3lpY
AEI/OAsiAZLZP23scVqo7z3T9rYM0uUtW5XpW98eJSYlQ+JFe0DE7/oKyeETqVRE
GZ6XtAf+rVEZ/8awa7QBcfFmQ2qxYNQGPewudTVRR9//PhFBn2jCvmqDvg26+zA6
CAkDDcfQb4NLIjvnviZxkQhaXUPdc+PaefCD6Pzx1qL0bUsY2zIUYnw1fV8uZ69K
YTZBewMyJRDQE8oz0NB+9xSpftG8yUlY2H4Xrwo9IEBfGwGsITAc1dv61lfrGrDO
hGC3bE8ucDb+IaClCtrBS3sOyxqRfS3BjrgjkmA4QUJYyXLsyvNYZeTWpcfhKopm
83ydESNX
=eGHB
-----END PGP SIGNATURE-----
Timestamp of file with hash cb3987fa66dbad9cd23f72f8b0cb42d860ccda592d0a20757c01c728c5eadf2e -
</details>
utACK https://github.com/bitcoin/bitcoin/pull/16059/commits/3b549f4aae9bc5f5f9e9dee8476523daf44dd7ee
To confirm: use_glibc_compat is by default disabled, correct?
To confirm: use_glibc_compat is by default disabled, correct?
Concept ACK, but I think that the logic here is complex enough that an --enable-threadlocal is necessary so that it can be chosen explicitly.
Concept ACK, but I think that the logic here is complex enough that an --enable-threadlocal is necessary so that it can be chosen explicitly.
As in:
--enable-threadlocal flag that will enable thread_local regardless of what --enable-glibc-back-compat says?--enable-threadlocal flag that will fail the configure if --enable-glibc-back-compat is also there?use_glibc_compat <-> thread_local interaction, add a --enable-threadlocal flag that will enable thread_local?I think it is nice to have thread_local enabled by default on the generic "64-bit Ubuntu Bionic" (and similar) environments. Thread names give developers additional debug information.
Option (1) is the way to go. If a user passes explicitly passes --enable-threadlocal or --disable-threadlocal, it should enable or disable thread local code respectively, regardless of other options. If neither is specified, it should choose an intelligent default based on the platform and maybe based on --glibc-back-compat.
Option (1) is the way to go. If a user passes explicitly passes --enable-threadlocal or --disable-threadlocal, it should enable or disable thread local code respectively, regardless of other options. If neither is specified, it should choose an intelligent default based on the platform and maybe based on --glibc-back-compat.
+1
Thread names give developers additional debug information.
They had thread names before thread_local :)
They had thread names before thread_local :)
I think @MarcoFalke is referring to the [threadname] prefixes on each log line, which did not exist before the merge of #15849.
Implemented logic as documented here: #16059 (comment)
193 | @@ -194,6 +194,12 @@ AC_ARG_ENABLE([glibc-back-compat], 194 | [use_glibc_compat=$enableval], 195 | [use_glibc_compat=no]) 196 | 197 | +AC_ARG_ENABLE([threadlocal], 198 | + [AS_HELP_STRING([--enable-threadlocal], 199 | + [enable thread_local code])],
Maybe could have more descriptive help text "enable features that depend on the c++ thread_local keyword (currently just thread names in debug logs). If unspecified, this will be enabled if there is platform support and glibc-back-compat is not enabled"
<!--a722867cd34abeea1fadc8d60700f111-->
Gitian builds for commit 2d1583ee6aff4b68dc46bcb87eb7a85f90b465c3 (master):
f55b412069904711bd300117d7bdc212... bitcoin-0.18.99-osx-unsigned.dmgc21869734ae349430e2d9b68d3c0278d... bitcoin-0.18.99-osx64.tar.gz352aa189594c0f5d2357c6e4f28bb966... bitcoin-0.18.99-win64-debug.zip0b6ed0d02ba5133bd99cfc79d5d413ce... bitcoin-0.18.99-win64-setup-unsigned.exe14a6165ab0f2594aadceea8717c11abc... bitcoin-0.18.99-win64.zip83b4227efbc50aca017907355a81c6f0... bitcoin-core-osx-0.19-res.yml8846699e3ebd9686a22f035d6d11060b... bitcoin-core-win-0.19-res.yml6ed8f8e851a0b9e8a848f40c97925f93... bitcoin-linux-build.logaf43fdb4c90ff38c3996fa15c4eae337... bitcoin-osx-build.loge6496d658405f10cf9897a78dd58d593... bitcoin-win-build.logGitian builds for commit 256e35348968dc048f175507999c466654294194 (master and this pull):
2a360f1141e4066b9ca3325d41120f66... bitcoin-0.18.99-aarch64-linux-gnu-debug.tar.gz0d7e5069cc83262ecef8b5f98386038f... bitcoin-0.18.99-aarch64-linux-gnu.tar.gz51311d27b6fedb93d8eb691371d67c99... bitcoin-0.18.99-arm-linux-gnueabihf-debug.tar.gzf2506d1c366631f779c96c713f1f3ecb... bitcoin-0.18.99-arm-linux-gnueabihf.tar.gzd8206d67d6a1332eca22ae0c0d34a0e6... bitcoin-0.18.99-i686-pc-linux-gnu-debug.tar.gz752766a0af7dffbe5a3b067f83e5e753... bitcoin-0.18.99-i686-pc-linux-gnu.tar.gze78d80031010072e25d36530460d7f93... bitcoin-0.18.99-osx-unsigned.dmg5b178a416857bf6776f4df245e8d318b... bitcoin-0.18.99-osx64.tar.gzde76f7acf9e36286727715926943575e... bitcoin-0.18.99-riscv64-linux-gnu-debug.tar.gzf8d88816f8ea15e498d211eb57c38474... bitcoin-0.18.99-riscv64-linux-gnu.tar.gzdb78b24ad01a30a20763b10fbd7ce1fa... bitcoin-0.18.99-win64-debug.zipa2f6b5c601f811284180318cd7c6edae... bitcoin-0.18.99-win64-setup-unsigned.exe9706ebea40e7617620ead4ae51ea0560... bitcoin-0.18.99-win64.zipdb2e72cbe4cd2ed92d917e7b83a247a5... bitcoin-0.18.99-x86_64-linux-gnu-debug.tar.gz52aa8ce724d7394c095c2e2526cec328... bitcoin-0.18.99-x86_64-linux-gnu.tar.gzc9bb3717c91889c876f7b84f154562c9... bitcoin-0.18.99.tar.gz606153db807aab097e6c850c53d53a6c... bitcoin-core-linux-0.19-res.ymlb0490ddecf260de92cb5234510629561... bitcoin-core-osx-0.19-res.yml72ffbfb8b35cd8bf94d3b3dd9360e7b5... bitcoin-core-win-0.19-res.yml2d7065570830e750ae908b88f0460e64... bitcoin-linux-build.log2c3105309ad72e801a98233edc09bd0a... bitcoin-osx-build.log50fad7bac6c80fe37f8f965541ff1f68... bitcoin-win-build.log<!--a722867cd34abeea1fadc8d60700f111-->
Gitian builds for commit 3001cc61cf11e016c403ce83c9cbcfd3efcbcfd9 (master):
15b471a7b08d6bd0c1cae96f073aef4b... bitcoin-0.18.99-osx-unsigned.dmg45262dff43ecd3eab71c5968210bbd31... bitcoin-0.18.99-osx64.tar.gzc7e1076ae7761619b238069eb66f314f... bitcoin-0.18.99-win64-debug.zipbb0445848e6e33be45a6dd52cf66780c... bitcoin-0.18.99-win64-setup-unsigned.exe8278d9e77eea04629372152a43a3c356... bitcoin-0.18.99-win64.zipf3a20c18807b1426639b7d1fc49c3f98... bitcoin-core-osx-0.19-res.yml519a40aea2793ff44530f1dca4dea241... bitcoin-core-win-0.19-res.yml033a78687856f5dbee10443e0116628c... bitcoin-linux-build.log96837efa33aeebc77116f1269f94bc3d... bitcoin-osx-build.log44d74a0e5956a7fd5823766dcae684b5... bitcoin-win-build.logGitian builds for commit 3f02161dd63d4983ae2b356dfea3dd4e45ee1f4a (master and this pull):
47e3d70fb682be0e076929ea2fdd58a8... bitcoin-0.18.99-aarch64-linux-gnu-debug.tar.gz8e1d54af0892e9b2d87c733f76c726d4... bitcoin-0.18.99-aarch64-linux-gnu.tar.gz54393c272d89cae20ce24d14e1634c96... bitcoin-0.18.99-arm-linux-gnueabihf-debug.tar.gzc023fdc23ec1df95d1c9af603b1c45a2... bitcoin-0.18.99-arm-linux-gnueabihf.tar.gza5f964bf917af1725e21bbe623322a05... bitcoin-0.18.99-i686-pc-linux-gnu-debug.tar.gzabe8cb0aa141d40153fbcea2dc30d468... bitcoin-0.18.99-i686-pc-linux-gnu.tar.gz20345d34251c8bc9bb5f0b3d22f0bc01... bitcoin-0.18.99-osx-unsigned.dmg1c8ead189bb88c9fc2a105d523a480b0... bitcoin-0.18.99-osx64.tar.gz80775d956e37716726596bef47f0a3fc... bitcoin-0.18.99-riscv64-linux-gnu-debug.tar.gz0a1c3325e87bad445158259bdcfabfa6... bitcoin-0.18.99-riscv64-linux-gnu.tar.gz3793cbd9f47a3fcc06a50d1e8f75fb1e... bitcoin-0.18.99-win64-debug.zip26611b54f38193f98c936f3dcea458df... bitcoin-0.18.99-win64-setup-unsigned.exe72e69f12f06b37bbead526e6c90bdfbb... bitcoin-0.18.99-win64.zip6064dae9f9902258c75c155cf25addc2... bitcoin-0.18.99-x86_64-linux-gnu-debug.tar.gz4623a430675ff3ff52bbdbe5f962c51a... bitcoin-0.18.99-x86_64-linux-gnu.tar.gz2b13418456b5e6819ece5441245f7300... bitcoin-0.18.99.tar.gz933e983d06360076e594df12dc7c4dda... bitcoin-core-linux-0.19-res.ymlee297c45b11d24a4ec28c913c494a7b4... bitcoin-core-osx-0.19-res.yml0657152da3522f1c5a901b6252cb085e... bitcoin-core-win-0.19-res.yml8cebd95b0f75c4f56b1e5bef985ddf1c... bitcoin-linux-build.log06ee837829cfc8cc8f8bce9e58ef9972... bitcoin-osx-build.logb43d40d096852cae90dc90f720155706... bitcoin-win-build.logutACK caaa942a5ff372db723a224c35236df48b93ebcb
<details><summary>Show signature and timestamp</summary>
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
utACK caaa942a5ff372db723a224c35236df48b93ebcb
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgOcAwAqOf1q52e0OmUrUy+lg0FHlFZ/F4VXVN/NtRAa7wP1KO+GsQacvFuKlOT
7T9V7KFqdRbj9RsxwXd77ZwXkhA7PDOn5Z8ja4GvnH/Z8KXOOKyPKJF9Bw6qtUH0
7ghGVa1eawGNddId5WQfhdJygwjbuwPZbqkxY3dLW1puXXXV7+RkWnEz6c+eZG2b
zJ84SlRd8BvGDcRqSoSGtH4kwXbfjYwQMk1+wt1j534/UgHq4ubHOPiSq38GMF2X
PmK6LGlG0PO9sU4hV5a62k5aZ0cW22n3HlL6MVTODAkSci7Cfd2Mo84dNC8TevOU
NU+J5wTaqDn84tLKRBWvPdtH3pb1L2WtKVPQ1sVCFrXFsguGnPhKy8r7rB8dgjkz
efLYbXO8vGK1GRTqsFsyAsxi7/AMS4PyIG19nnazGw2WmVIqcRp7D6ZTE+uEpCyV
Z7cB4UgtZo9MdrwJqmjkbHXD45NHjxvy5SsXtVRcWzQ2J50BsCn+rfLZxkc484jJ
srQR/1SK
=9lnG
-----END PGP SIGNATURE-----
Timestamp of file with hash 92094b899f3571c01b98c4d14e9586500a17402059ac90ca5200d93dc689eef3 -
</details>
Concept ACK
utACK caaa942a5ff372db723a224c35236df48b93ebcb. Change looks good to me. I just suggested adding some more documentation below. IMO, the glibc-back-compat option is also underdocumented, and is perhaps trying to control too many disparate things. My instinct would be to make the --enable-threadlocal and --enable-glibc-back-compat options independent and just pass them both where needed. But I don't know all the context, and the change seems fine in its present form.
- When aiming for glibc compatibility, don't use thread_local.
- Add a flag --enable-threadlocal, which, when specified, will
enable/disable thread_local regardless of the value of glibc_compat.
- FreeBSD has a buggy thread_local, don't use it.
Update: better help text.
utACK 480e3415d738a4e0e2ad9774c43f29937178ecae
tACK 480e341
macOS:
checking for thread_local support... no
src/bitcoind -logthreadnames=1
2019-05-23T20:27:48Z [] Bitcoin Core version v0.18.99.0-480e3415d (release build)
2019-05-23T20:27:48Z [] Assuming ancestors of block 0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee have valid signatures.
openBSD 6.4:
checking for thread_local support... yes
./src/bitcoind -logthreadnames=1
2019-05-23T20:41:11Z [init] mapBlockIndex.size() = 1
2019-05-23T20:41:11Z [loadblk] Failed to open mempool file from disk. Continuing anyway.
......
2019-05-23T20:41:58Z [shutoff] [default wallet] Releasing wallet
2019-05-23T20:41:58Z [shutoff] Shutdown: done
FreeBSD 12.0:
checking for thread_local support... no
src/bitcoind -logthreadnames=1
2019-05-24T16:06:38Z [] Bitcoin Core version v0.18.99.0-480e3415d (release build)
2019-05-24T16:06:38Z [] Assuming ancestors of block 0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee have valid signatures.
Debian 9.9:
checking for thread_local support... yes
src/bitcoind -logthreadnames=1
src/bitcoind -logthreadnames=1
2019-05-24T17:07:14Z [init] Bitcoin Core version v0.18.99.0-480e3415d (release build)
2019-05-24T17:07:14Z [init] Assuming ancestors of block 0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee have valid signatures.