diff --git a/source/dnode/mgmt/container/src/dndExec.c b/source/dnode/mgmt/container/src/dndExec.c index d5c882398ede007bf6b047f2c4c7454b99c5ef73..6d07ca189859fc7c26070b26c7ad8d717c1089a5 100644 --- a/source/dnode/mgmt/container/src/dndExec.c +++ b/source/dnode/mgmt/container/src/dndExec.c @@ -50,16 +50,23 @@ int32_t dndOpenNode(SMgmtWrapper *pWrapper) { } void dndCloseNode(SMgmtWrapper *pWrapper) { + dDebug("node:%s, start to close", pWrapper->name); taosWLockLatch(&pWrapper->latch); if (pWrapper->deployed) { (*pWrapper->fp.closeFp)(pWrapper); pWrapper->deployed = false; } + taosWUnLockLatch(&pWrapper->latch); + + while (pWrapper->refCount > 0) { + taosMsleep(10); + } + if (pWrapper->pProc) { taosProcCleanup(pWrapper->pProc); pWrapper->pProc = NULL; } - taosWUnLockLatch(&pWrapper->latch); + dDebug("node:%s, has been closed", pWrapper->name); } static int32_t dndRunInSingleProcess(SDnode *pDnode) {