fix(client): fix deadlock.

This commit is contained in:
Haojun Liao 2024-04-26 23:09:17 +08:00
parent 9df2bc2634
commit 12570d7390
2 changed files with 18 additions and 7 deletions

View File

@ -1856,8 +1856,6 @@ static void taosSetAllDebugFlag(SConfig *pCfg, int32_t flag) {
return; return;
} }
cfgLock(pCfg);
SArray *noNeedToSetVars = NULL; SArray *noNeedToSetVars = NULL;
SConfigItem *pItem = cfgGetItem(pCfg, "debugFlag"); SConfigItem *pItem = cfgGetItem(pCfg, "debugFlag");
if (pItem != NULL) { if (pItem != NULL) {
@ -1895,8 +1893,6 @@ static void taosSetAllDebugFlag(SConfig *pCfg, int32_t flag) {
if (terrno == TSDB_CODE_CFG_NOT_FOUND) { if (terrno == TSDB_CODE_CFG_NOT_FOUND) {
terrno = TSDB_CODE_SUCCESS; // ignore not exist terrno = TSDB_CODE_SUCCESS; // ignore not exist
} }
cfgUnLock(pCfg);
} }
int8_t taosGranted(int8_t type) { int8_t taosGranted(int8_t type) {

View File

@ -420,6 +420,7 @@ int32_t cfgCheckRangeForDynUpdate(SConfig *pCfg, const char *name, const char *p
if (!pItem || (pItem->dynScope & dynType) == 0) { if (!pItem || (pItem->dynScope & dynType) == 0) {
uError("failed to config:%s, not support update this config", name); uError("failed to config:%s, not support update this config", name);
terrno = TSDB_CODE_INVALID_CFG; terrno = TSDB_CODE_INVALID_CFG;
cfgUnLock(pCfg);
return -1; return -1;
} }
@ -429,28 +430,37 @@ int32_t cfgCheckRangeForDynUpdate(SConfig *pCfg, const char *name, const char *p
if (ival != 0 && ival != 1) { if (ival != 0 && ival != 1) {
uError("cfg:%s, type:%s value:%d out of range[0, 1]", pItem->name, cfgDtypeStr(pItem->dtype), ival); uError("cfg:%s, type:%s value:%d out of range[0, 1]", pItem->name, cfgDtypeStr(pItem->dtype), ival);
terrno = TSDB_CODE_OUT_OF_RANGE; terrno = TSDB_CODE_OUT_OF_RANGE;
cfgUnLock(pCfg);
return -1; return -1;
} }
} break; } break;
case CFG_DTYPE_INT32: { case CFG_DTYPE_INT32: {
int32_t ival; int32_t ival;
int32_t code = (int32_t)taosStrHumanToInt32(pVal, &ival); int32_t code = (int32_t)taosStrHumanToInt32(pVal, &ival);
if (code != TSDB_CODE_SUCCESS) return code; if (code != TSDB_CODE_SUCCESS) {
cfgUnLock(pCfg);
return code;
}
if (ival < pItem->imin || ival > pItem->imax) { if (ival < pItem->imin || ival > pItem->imax) {
uError("cfg:%s, type:%s value:%d out of range[%" PRId64 ", %" PRId64 "]", pItem->name, uError("cfg:%s, type:%s value:%d out of range[%" PRId64 ", %" PRId64 "]", pItem->name,
cfgDtypeStr(pItem->dtype), ival, pItem->imin, pItem->imax); cfgDtypeStr(pItem->dtype), ival, pItem->imin, pItem->imax);
terrno = TSDB_CODE_OUT_OF_RANGE; terrno = TSDB_CODE_OUT_OF_RANGE;
cfgUnLock(pCfg);
return -1; return -1;
} }
} break; } break;
case CFG_DTYPE_INT64: { case CFG_DTYPE_INT64: {
int64_t ival; int64_t ival;
int32_t code = taosStrHumanToInt64(pVal, &ival); int32_t code = taosStrHumanToInt64(pVal, &ival);
if (code != TSDB_CODE_SUCCESS) return code; if (code != TSDB_CODE_SUCCESS) {
cfgUnLock(pCfg);
return code;
}
if (ival < pItem->imin || ival > pItem->imax) { if (ival < pItem->imin || ival > pItem->imax) {
uError("cfg:%s, type:%s value:%" PRId64 " out of range[%" PRId64 ", %" PRId64 "]", pItem->name, uError("cfg:%s, type:%s value:%" PRId64 " out of range[%" PRId64 ", %" PRId64 "]", pItem->name,
cfgDtypeStr(pItem->dtype), ival, pItem->imin, pItem->imax); cfgDtypeStr(pItem->dtype), ival, pItem->imin, pItem->imax);
terrno = TSDB_CODE_OUT_OF_RANGE; terrno = TSDB_CODE_OUT_OF_RANGE;
cfgUnLock(pCfg);
return -1; return -1;
} }
} break; } break;
@ -458,11 +468,15 @@ int32_t cfgCheckRangeForDynUpdate(SConfig *pCfg, const char *name, const char *p
case CFG_DTYPE_DOUBLE: { case CFG_DTYPE_DOUBLE: {
double dval; double dval;
int32_t code = parseCfgReal(pVal, &dval); int32_t code = parseCfgReal(pVal, &dval);
if (code != TSDB_CODE_SUCCESS) return code; if (code != TSDB_CODE_SUCCESS) {
cfgUnLock(pCfg);
return code;
}
if (dval < pItem->fmin || dval > pItem->fmax) { if (dval < pItem->fmin || dval > pItem->fmax) {
uError("cfg:%s, type:%s value:%f out of range[%f, %f]", pItem->name, cfgDtypeStr(pItem->dtype), dval, uError("cfg:%s, type:%s value:%f out of range[%f, %f]", pItem->name, cfgDtypeStr(pItem->dtype), dval,
pItem->fmin, pItem->fmax); pItem->fmin, pItem->fmax);
terrno = TSDB_CODE_OUT_OF_RANGE; terrno = TSDB_CODE_OUT_OF_RANGE;
cfgUnLock(pCfg);
return -1; return -1;
} }
} break; } break;
@ -470,6 +484,7 @@ int32_t cfgCheckRangeForDynUpdate(SConfig *pCfg, const char *name, const char *p
break; break;
} }
cfgUnLock(pCfg);
return 0; return 0;
} }