未验证 提交 38c0244e 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #8780 from taosdata/fix/TS-707

[TS-707]<fix>: fixed crash when cleanup was called before creating all http threads
......@@ -53,7 +53,7 @@ static void httpStopThread(HttpThread *pThread) {
break;
}
} while (0);
if (r) {
if (r && taosCheckPthreadValid(pThread->thread)) {
pthread_cancel(pThread->thread);
}
#else
......@@ -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",
pThread->label, strerror(errno));
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) {
httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s",
pThread->label, strerror(errno));
pthread_cancel(pThread->thread);
if (taosCheckPthreadValid(pThread->thread)) {
pthread_cancel(pThread->thread);
}
}
#endif // __APPLE__
pthread_join(pThread->thread, NULL);
if (taosCheckPthreadValid(pThread->thread)) {
pthread_join(pThread->thread, NULL);
}
#ifdef __APPLE__
if (sv[0] != -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册