-
Notifications
You must be signed in to change notification settings - Fork 38.7k
refactor: Replace thread_local use with a mutex-protected map #18851
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
This replaces the only use of `thread_local` with a mutex-protected map. This leaks per thread, but because bitcoin's threads are static and permanent, this is not a problem in practice. Add a note to the thread rename function to only call it for permanent threads, just in case. Also removes associated build system functionality. Closes bitcoin#18678.
78031df to
c793389
Compare
|
Concept / code review ACK c793389 modulo someone testing that it does fix the performance issue linked |
|
Concept ACK if this fixes the problem. Will test when my new hardware arrives |
|
If this doesn't solve the problem, then the problem isn't thread_local but looking up thread names in the first place, and we should remove thread name logging completely (as well as thread_local). A workaround then that would avoid the need for this bookkeeping at all would be:
|
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK. Keep testing. |
|
Testing on ODROID-HC1: UPDATE: sorry, wrong branch compiled |
|
Here are results of three consequent tests on ODROID-HC1: The related log: |
|
It seems |
|
Okay. So is it still worth keeping this open? It would make thread-name logging work in the gitian-built binaries which lack |
Correct. So keep reviewing. |
|
I am currently syncing a node to debug this issue. Also, glibc can probably be bumped by one minor version in the next release, which is going to switch to C++17. Then, potentially the same build cleanups can be done? |
This replaces the only use of
thread_localwith a mutex-protected map.This leaks per thread, but because bitcoin's threads are static and permanent, this is not a problem in practice. Add a note to the thread rename function to only call it for permanent threads, just in case.
Also removes associated build system functionality.
Closes #18678.