Work around flow trace's data race bug (#7237)

* Work around flow trace's data race bug

BaseTraceEvent::setNetworkThread() and flushTraceFile[()|Void()]
has a long-standing race condition for traceEventThrottlerCache global
when flushTraceFileVoid() is not called from the network thread.

This race dates back to 2017 (commit hash 80e5fecfe2),
so before the race itself is fixed, work around the problem.

* Remove call to flushTraceFileVoid() from MkCertCli

* Apply clang format
This commit is contained in:
Junhyun Shim 2022-06-14 12:09:34 +02:00 committed by GitHub
parent ddbecb69ad
commit ed91ab5d54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -278,14 +278,11 @@ int main(int argc, char** argv) {
Error::init();
g_network = newNet2(TLSConfig());
openTraceFile(NetworkAddress(), 10 << 20, 10 << 20, ".", "mkcert");
auto thread = std::thread([]() {
TraceEvent::setNetworkThread();
g_network->run();
});
auto thread = std::thread([]() { g_network->run(); });
auto cleanUpGuard = ScopeExit([&thread]() {
flushTraceFileVoid();
g_network->stop();
thread.join();
closeTraceFile();
});
serverArgs.transformPathToAbs();