sofastack / sofa-rpc-node

SOFARPC Node is a high-performance, high-extensibility, production-level Nodejs RPC framework.
MIT License
612 stars 64 forks source link

zk断网或者本地断网超过N分钟后,死循环导致内存严重泄漏 #85

Closed wuteng606 closed 2 years ago

wuteng606 commented 2 years ago

data_client文件中 zk 重连函数,for循环,遍历 map的keys,并且会触发 zookeeper-client:watcher事件 image

api_client中监听zookeeper-client:watcher 最终会触发data_client的invokeWithWatcher,因为是操作的同一个map _watchers 会导致一个死循环,map永远无法清空,所以需将data_client中的 for (const key of this._watchers.keys()) 替换为 const keys = [...this._watchers.keys()]; for(const key of keys) image