Call getTraceThreadId() before we enable allocation tracing (#7888)

This commit is contained in:
Marian Dvorsky 2022-08-23 20:25:08 +02:00 committed by GitHub
parent e705b055b0
commit 3a53ec3115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1286,6 +1286,10 @@ thread_local bool BaseTraceEvent::networkThread = false;
void BaseTraceEvent::setNetworkThread() {
if (!networkThread) {
if (FLOW_KNOBS->ALLOCATION_TRACING_ENABLED) {
// Ensure that threadId is initialized before we enable allocation tracing, otherwise it would
// be initialized either by first normal usage of TraceEvent or by allocation tracing which is
// non-deterministic, and we could run into https://github.com/apple/foundationdb/issues/7872.
getTraceThreadId();
--g_allocation_tracing_disabled;
}