From 740af8eaf7dfa50a0a508ccd01d1e85ae1823a2d Mon Sep 17 00:00:00 2001 From: slguan Date: Thu, 7 May 2020 23:02:19 +0800 Subject: [PATCH] crash while release http --- src/plugins/http/src/httpServer.c | 7 ++++--- src/plugins/http/src/httpSystem.c | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index a0d3b6314d..51795a570d 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -269,11 +269,12 @@ void httpCleanUpConnect(HttpServer *pServer) { for (i = 0; i < pServer->numOfThreads; ++i) { pThread = pServer->pThreads + i; + if (pThread == NULL) continue; //taosCloseSocket(pThread->pollFd); - while (pThread->pHead) { - httpCleanUpContext(pThread->pHead, 0); - } + //while (pThread->pHead) { + // httpCleanUpContext(pThread->pHead, 0); + //} pthread_cancel(pThread->thread); pthread_join(pThread->thread, NULL); diff --git a/src/plugins/http/src/httpSystem.c b/src/plugins/http/src/httpSystem.c index 9a8841b8de..8b95077632 100644 --- a/src/plugins/http/src/httpSystem.c +++ b/src/plugins/http/src/httpSystem.c @@ -131,7 +131,11 @@ void httpCleanUpSystem() { httpServer->timerHandle = NULL; } - httpCleanUpConnect(httpServer); + if (httpServer->pThreads != NULL) { + httpCleanUpConnect(httpServer); + httpServer->pThreads = NULL; + } + #if 0 httpRemoveAllSessions(httpServer);