提交 81bbf6c8 编写于 作者: X xywang

[TS-707]<fix>: fixed crash when cleanup was called before creating all http threads

上级 44ece9a1
...@@ -53,7 +53,7 @@ static void httpStopThread(HttpThread *pThread) { ...@@ -53,7 +53,7 @@ static void httpStopThread(HttpThread *pThread) {
break; break;
} }
} while (0); } while (0);
if (r) { if (r && taosCheckPthreadValid(pThread->thread)) {
pthread_cancel(pThread->thread); pthread_cancel(pThread->thread);
} }
#else #else
...@@ -63,15 +63,21 @@ static void httpStopThread(HttpThread *pThread) { ...@@ -63,15 +63,21 @@ static void httpStopThread(HttpThread *pThread) {
httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s",
pThread->label, strerror(errno)); pThread->label, strerror(errno));
pThread->stop = true; pThread->stop = true;
pthread_cancel(pThread->thread); if (taosCheckPthreadValid(pThread->thread)) {
pthread_cancel(pThread->thread);
}
} else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { } else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) {
httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s",
pThread->label, strerror(errno)); pThread->label, strerror(errno));
pthread_cancel(pThread->thread); if (taosCheckPthreadValid(pThread->thread)) {
pthread_cancel(pThread->thread);
}
} }
#endif // __APPLE__ #endif // __APPLE__
pthread_join(pThread->thread, NULL); if (taosCheckPthreadValid(pThread->thread)) {
pthread_join(pThread->thread, NULL);
}
#ifdef __APPLE__ #ifdef __APPLE__
if (sv[0] != -1) { if (sv[0] != -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册