diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go
index 99167088ae4396adf2c914b06969455b7030be7d..e5ddcadeaca9c3ce972cbe781413ebec7393afce 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)