fix taos -s caused memory leak and crash
This commit is contained in:
parent
81e88d9762
commit
d7ee1ec49b
|
@ -373,6 +373,7 @@ int taos_options_imp(TSDB_OPTION option, const char* str);
|
||||||
|
|
||||||
int32_t openTransporter(const char* user, const char* auth, int32_t numOfThreads, void **pDnodeConn);
|
int32_t openTransporter(const char* user, const char* auth, int32_t numOfThreads, void **pDnodeConn);
|
||||||
void tscStopCrashReport();
|
void tscStopCrashReport();
|
||||||
|
void cleanupAppInfo();
|
||||||
|
|
||||||
typedef struct AsyncArg {
|
typedef struct AsyncArg {
|
||||||
SRpcMsg msg;
|
SRpcMsg msg;
|
||||||
|
|
|
@ -688,7 +688,6 @@ void doDestroyRequest(void *p) {
|
||||||
|
|
||||||
taosArrayDestroy(pRequest->tableList);
|
taosArrayDestroy(pRequest->tableList);
|
||||||
taosArrayDestroy(pRequest->targetTableList);
|
taosArrayDestroy(pRequest->targetTableList);
|
||||||
|
|
||||||
destroyQueryExecRes(&pRequest->body.resInfo.execRes);
|
destroyQueryExecRes(&pRequest->body.resInfo.execRes);
|
||||||
|
|
||||||
if (pRequest->self) {
|
if (pRequest->self) {
|
||||||
|
@ -702,12 +701,7 @@ void doDestroyRequest(void *p) {
|
||||||
}
|
}
|
||||||
taosMemoryFree(pRequest->body.interParam);
|
taosMemoryFree(pRequest->body.interParam);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == nodesSimAcquireAllocator(pRequest->allocatorRefId)) {
|
|
||||||
qDestroyQuery(pRequest->pQuery);
|
qDestroyQuery(pRequest->pQuery);
|
||||||
if (TSDB_CODE_SUCCESS != nodesSimReleaseAllocator(pRequest->allocatorRefId)) {
|
|
||||||
tscError("failed to release allocator");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nodesDestroyAllocator(pRequest->allocatorRefId);
|
nodesDestroyAllocator(pRequest->allocatorRefId);
|
||||||
|
|
||||||
taosMemoryFreeClear(pRequest->effectiveUser);
|
taosMemoryFreeClear(pRequest->effectiveUser);
|
||||||
|
|
|
@ -68,6 +68,10 @@ bool chkRequestKilled(void* param) {
|
||||||
return killed;
|
return killed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cleanupAppInfo() {
|
||||||
|
taosHashCleanup(appInfo.pInstMap);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param,
|
static int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param,
|
||||||
SAppInstInfo* pAppInfo, int connType, STscObj** pTscObj);
|
SAppInstInfo* pAppInfo, int connType, STscObj** pTscObj);
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ void taos_cleanup(void) {
|
||||||
|
|
||||||
fmFuncMgtDestroy();
|
fmFuncMgtDestroy();
|
||||||
qCleanupKeywordsTable();
|
qCleanupKeywordsTable();
|
||||||
nodesDestroyAllocatorSet();
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != cleanupTaskQueue()) {
|
if (TSDB_CODE_SUCCESS != cleanupTaskQueue()) {
|
||||||
tscWarn("failed to cleanup task queue");
|
tscWarn("failed to cleanup task queue");
|
||||||
|
@ -85,6 +84,8 @@ void taos_cleanup(void) {
|
||||||
tscWarn("failed to close clientReqRefPool");
|
tscWarn("failed to close clientReqRefPool");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodesDestroyAllocatorSet();
|
||||||
|
cleanupAppInfo();
|
||||||
rpcCleanup();
|
rpcCleanup();
|
||||||
tscDebug("rpc cleanup");
|
tscDebug("rpc cleanup");
|
||||||
|
|
||||||
|
|
|
@ -1170,6 +1170,7 @@ bool shellGetGrantInfo(char* buf) {
|
||||||
code != TSDB_CODE_PAR_PERMISSION_DENIED) {
|
code != TSDB_CODE_PAR_PERMISSION_DENIED) {
|
||||||
fprintf(stderr, "Failed to check Server Edition, Reason:0x%04x:%s\r\n\r\n", code, taos_errstr(tres));
|
fprintf(stderr, "Failed to check Server Edition, Reason:0x%04x:%s\r\n\r\n", code, taos_errstr(tres));
|
||||||
}
|
}
|
||||||
|
taos_free_result(tres);
|
||||||
return community;
|
return community;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue