From 90c9eae23ee588508e0e9b5e65fcb3ca2a8fb10e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sat, 1 Aug 2020 12:37:38 +0800 Subject: [PATCH] fd maybe reused while close httpcontext --- src/plugins/http/src/httpContext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/http/src/httpContext.c b/src/plugins/http/src/httpContext.c index ad72ac8823..e367911695 100644 --- a/src/plugins/http/src/httpContext.c +++ b/src/plugins/http/src/httpContext.c @@ -31,8 +31,8 @@ static void httpRemoveContextFromEpoll(HttpContext *pContext) { HttpThread *pThread = pContext->pThread; if (pContext->fd >= 0) { epoll_ctl(pThread->pollFd, EPOLL_CTL_DEL, pContext->fd, NULL); - taosCloseSocket(pContext->fd); - pContext->fd = -1; + int32_t fd = atomic_val_compare_exchange_32(&pContext->fd, pContext->fd, -1); + taosCloseSocket(fd); } } -- GitLab