Close file at the end of runNetwork rather than in stopNetwork in order to avoid a race condition,

also in order to continue tracing the pending network thread activity.
Poll event throttler only in the network thread in order to avoid a race condition.
This commit is contained in:
Vaidas Gasiunas 2022-05-31 13:59:09 +02:00
parent 46af909411
commit 4d6ec7663f
3 changed files with 4 additions and 2 deletions

View File

@ -2555,7 +2555,6 @@ void stopNetwork() {
TraceEvent("ClientStopNetwork").log();
g_network->stop();
closeTraceFile();
}
void DatabaseContext::updateProxies() {

View File

@ -591,6 +591,7 @@ void ThreadSafeApi::runNetwork() {
}
TraceEvent("RunNetworkTerminating");
closeTraceFile();
}
void ThreadSafeApi::stopNetwork() {

View File

@ -454,7 +454,9 @@ public:
}
ThreadFuture<Void> flush() {
traceEventThrottlerCache->poll();
if (TraceEvent::isNetworkThread()) {
traceEventThrottlerCache->poll();
}
MutexHolder hold(mutex);
bool roll = false;