1
0
mirror of https://github.com/apple/foundationdb.git synced 2025-05-22 06:40:01 +08:00

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

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

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

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