commit
546d3b128e
|
@ -190,6 +190,7 @@ void dnodeFreeVnodeWqueue(void *wqueue) {
|
||||||
|
|
||||||
void dnodeSendRpcVnodeWriteRsp(void *pVnode, void *param, int32_t code) {
|
void dnodeSendRpcVnodeWriteRsp(void *pVnode, void *param, int32_t code) {
|
||||||
SWriteMsg *pWrite = (SWriteMsg *)param;
|
SWriteMsg *pWrite = (SWriteMsg *)param;
|
||||||
|
if (pWrite == NULL) return;
|
||||||
|
|
||||||
if (code < 0) pWrite->code = code;
|
if (code < 0) pWrite->code = code;
|
||||||
int32_t count = atomic_add_fetch_32(&pWrite->processedCount, 1);
|
int32_t count = atomic_add_fetch_32(&pWrite->processedCount, 1);
|
||||||
|
|
|
@ -174,12 +174,15 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
|
||||||
pThreadObj->stop = true;
|
pThreadObj->stop = true;
|
||||||
eventfd_t fd = -1;
|
eventfd_t fd = -1;
|
||||||
|
|
||||||
|
// save thread into local variable since pThreadObj is freed when thread exits
|
||||||
|
pthread_t thread = pThreadObj->thread;
|
||||||
|
|
||||||
if (taosComparePthread(pThreadObj->thread, pthread_self())) {
|
if (taosComparePthread(pThreadObj->thread, pthread_self())) {
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosCheckPthreadValid(pThreadObj->thread) && pThreadObj->pollFd >= 0) {
|
if (taosCheckPthreadValid(pThreadObj->thread)) {
|
||||||
// signal the thread to stop, try graceful method first,
|
// signal the thread to stop, try graceful method first,
|
||||||
// and use pthread_cancel when failed
|
// and use pthread_cancel when failed
|
||||||
struct epoll_event event = { .events = EPOLLIN };
|
struct epoll_event event = { .events = EPOLLIN };
|
||||||
|
@ -196,8 +199,9 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosCheckPthreadValid(pThreadObj->thread) && pThreadObj->pollFd >= 0) {
|
// at this step, pThreadObj has already been released
|
||||||
pthread_join(pThreadObj->thread, NULL);
|
if (taosCheckPthreadValid(thread)) {
|
||||||
|
pthread_join(thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd != -1) taosCloseSocket(fd);
|
if (fd != -1) taosCloseSocket(fd);
|
||||||
|
|
Loading…
Reference in New Issue