From 74e28be837d6ebc07b79fa251df92dff947000cd Mon Sep 17 00:00:00 2001
From: cadeeper <cadeeper@gmail.com>
Date: Fri, 6 Nov 2020 14:12:50 +0800
Subject: [PATCH] fix bug: pathMap cache need to delete after node removed

---
 remoting/zookeeper/listener.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go
index 99167088a..e5ddcadea 100644
--- a/remoting/zookeeper/listener.go
+++ b/remoting/zookeeper/listener.go
@@ -302,8 +302,8 @@ func (l *ZkEventListener) listenDirEvent(conf *common.URL, zkPath string, listen
 				if l.listenServiceNodeEvent(zkPath) {
 					listener.DataChange(remoting.Event{Path: zkPath, Action: remoting.EventTypeDel})
 					l.pathMapLock.Lock()
+					defer l.pathMapLock.Unlock()
 					delete(l.pathMap, zkPath)
-					l.pathMapLock.Unlock()
 				}
 				logger.Warnf("listenSelf(zk path{%s}) goroutine exit now", zkPath)
 			}(dubboPath, listener)
-- 
GitLab