From f949b732f5051ad95893c5ea994907362e9dcb5f Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Thu, 1 Oct 2020 14:55:00 +0000 Subject: [PATCH] TD-1645 --- src/rpc/src/rpcTcp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 97a3dad1eb..2119824b3d 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -205,7 +205,14 @@ void taosStopTcpServer(void *handle) { if (pServerObj == NULL) return; if(pServerObj->fd >=0) shutdown(pServerObj->fd, SHUT_RD); - if (taosCheckPthreadValid(pServerObj->thread)) pthread_join(pServerObj->thread, NULL); + + if (taosCheckPthreadValid(pServerObj->thread)) { + if (pServerObj->thread == pthread_self()) { + pthread_detach(pthread_self()); + } else { + pthread_join(pServerObj->thread, NULL); + } + } tDebug("%s TCP server is stopped", pServerObj->label); } -- GitLab