Commit 30186d69 authored by Emanuele Altieri's avatar Emanuele Altieri Committed by Facebook GitHub Bot

Replace `LOG_FIRST_N`

Summary: TSAN reports race condition in `LOG_FIRST_N`. Replacing it with thread-safe alternatives.

Reviewed By: yfeldblum

Differential Revision: D28541027

fbshipit-source-id: 7054a82c7b26df395a25cd7cd7f921a9c636ffbc
parent 0fee9dfc
......@@ -104,7 +104,8 @@ static void fetchStackLimits() {
pthread_attr_t attr;
if ((err = pthread_getattr_np(pthread_self(), &attr))) {
// some restricted environments can't access /proc
LOG_FIRST_N(WARNING, 1) << "pthread_getaddr_np failed errno=" << err;
FB_LOG_EVERY_MS(WARNING, 60000)
<< "pthread_getaddr_np failed errno=" << err;
tls_stackSize = 1;
return;
}
......
......@@ -16,8 +16,7 @@
#include <folly/io/async/Request.h>
#include <glog/logging.h>
#include <folly/GLog.h>
#include <folly/MapUtil.h>
#include <folly/SingletonThreadLocal.h>
#include <folly/experimental/SingleWriterFixedHashMap.h>
......@@ -243,7 +242,7 @@ bool RequestContext::State::doSetContextData(
result = doSetContextDataHelper(token, data, behaviour, safe);
}
if (result.unexpected) {
LOG_FIRST_N(WARNING, 1)
FB_LOG_EVERY_MS(WARNING, 60000)
<< "Calling RequestContext::setContextData for "
<< token.getDebugString() << " but it is already set";
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment