From 0d353d2bd18913f054c9436fefaf668a4ed1ec28 Mon Sep 17 00:00:00 2001 From: "vito.he" Date: Mon, 19 Aug 2019 11:16:46 +0800 Subject: [PATCH 1/2] Fix:zk_hignmem_bug --- remoting/zookeeper/listener.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index 3df87ed4f6..4177ab07da 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -208,6 +208,20 @@ func (l *ZkEventListener) listenDirEvent(zkPath string, listener remoting.DataLi // listen l service node dubboPath := path.Join(zkPath, c) + + //Add to save into the path map to avoid duplicate listen + l.pathMapLock.Lock() + _, ok := l.pathMap[dubboPath] + l.pathMapLock.Unlock() + if ok { + logger.Warnf("@zkPath %s has already been listened.", zkPath) + continue + } + + l.pathMapLock.Lock() + l.pathMap[dubboPath] = struct{}{} + l.pathMapLock.Unlock() + content, _, err := l.client.Conn.Get(dubboPath) if err != nil { logger.Errorf("Get new node path {%v} 's content error,message is {%v}", dubboPath, perrors.WithStack(err)) From 18a9a4c608b2ad39230751283a5c5670d1e4f9f4 Mon Sep 17 00:00:00 2001 From: "vito.he" Date: Mon, 19 Aug 2019 11:47:09 +0800 Subject: [PATCH 2/2] Mod:comment --- 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 4177ab07da..d9efd4fed1 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -209,7 +209,7 @@ func (l *ZkEventListener) listenDirEvent(zkPath string, listener remoting.DataLi // listen l service node dubboPath := path.Join(zkPath, c) - //Add to save into the path map to avoid duplicate listen + //Save the path to avoid listen repeatly l.pathMapLock.Lock() _, ok := l.pathMap[dubboPath] l.pathMapLock.Unlock()