Fix TSAN race

Former-commit-id: f00d28fdabe858bd621a1bd98e40493aca5aba1e
This commit is contained in:
John Sully 2020-04-15 16:34:38 -04:00
parent 4ee29a3b25
commit fc66f768e0

View File

@ -32,6 +32,7 @@
#include "cron.h" #include "cron.h"
#include <math.h> #include <math.h>
#include <ctype.h> #include <ctype.h>
#include <mutex>
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#define strtold(a,b) ((long double)strtod((a),(b))) #define strtold(a,b) ((long double)strtod((a),(b)))
@ -1033,6 +1034,8 @@ struct redisMemOverhead *getMemoryOverheadData(void) {
while((ln = listNext(&li))) { while((ln = listNext(&li))) {
size_t mem_curr = 0; size_t mem_curr = 0;
client *c = (client*)listNodeValue(ln); client *c = (client*)listNodeValue(ln);
std::unique_lock<fastlock> ul(c->lock);
int type = getClientType(c); int type = getClientType(c);
mem_curr += getClientOutputBufferMemoryUsage(c); mem_curr += getClientOutputBufferMemoryUsage(c);
mem_curr += sdsAllocSize(c->querybuf); mem_curr += sdsAllocSize(c->querybuf);