fix: invalid read in multi-process mode
This commit is contained in:
parent
488539b977
commit
c335098acb
|
@ -455,25 +455,28 @@ void taosProcCleanup(SProcObj *pProc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen,
|
int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen,
|
||||||
void *handle, int64_t handleRef, EProcFuncType ftype) {
|
void *handle, int64_t ref, EProcFuncType ftype) {
|
||||||
if (ftype != PROC_FUNC_REQ) {
|
if (ftype != PROC_FUNC_REQ) {
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return taosProcQueuePush(pProc, pProc->pChildQueue, pHead, headLen, pBody, bodyLen, (int64_t)handle, handleRef,
|
return taosProcQueuePush(pProc, pProc->pChildQueue, pHead, headLen, pBody, bodyLen, (int64_t)handle, ref, ftype);
|
||||||
ftype);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taosProcRemoveHandle(SProcObj *pProc, void *handle) {
|
int64_t taosProcRemoveHandle(SProcObj *pProc, void *handle) {
|
||||||
int64_t h = (int64_t)handle;
|
int64_t h = (int64_t)handle;
|
||||||
taosThreadMutexLock(&pProc->pChildQueue->mutex);
|
taosThreadMutexLock(&pProc->pChildQueue->mutex);
|
||||||
|
|
||||||
int64_t *handleRef = taosHashGet(pProc->hash, &h, sizeof(int64_t));
|
int64_t *pRef = taosHashGet(pProc->hash, &h, sizeof(int64_t));
|
||||||
|
int64_t ref = 0;
|
||||||
|
if (pRef != NULL) {
|
||||||
|
ref = *pRef;
|
||||||
|
}
|
||||||
|
|
||||||
taosHashRemove(pProc->hash, &h, sizeof(int64_t));
|
taosHashRemove(pProc->hash, &h, sizeof(int64_t));
|
||||||
taosThreadMutexUnlock(&pProc->pChildQueue->mutex);
|
taosThreadMutexUnlock(&pProc->pChildQueue->mutex);
|
||||||
|
|
||||||
if (handleRef == NULL) return 0;
|
return ref;
|
||||||
return *handleRef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosProcCloseHandles(SProcObj *pProc, void (*HandleFp)(void *handle)) {
|
void taosProcCloseHandles(SProcObj *pProc, void (*HandleFp)(void *handle)) {
|
||||||
|
|
Loading…
Reference in New Issue