kazoo
kazoo copied to clipboard
Zookeeper Server's watch residue
Expected Behavior
According to Kazoo's documentation, after DataWatch returns False, the registered listener will be destroyed. Not only will Kazoo no longer trigger this listener, but when using wchp to view the zookeeper server, it should also not exist
Actual Behavior
According to Kazoo's documentation, after DataWatch returns False, the registered listener will be destroyed. However, in actual testing, it was found that although Kazoo will no longer trigger the listener, wchp can still find the listener in the zookeeper server
Snippet to Reproduce the Problem
COPY/PASTE the snippet here (omit any sensitive information)
from kazoo.client import KazooClient
import os
import time
zk_client = KazooClient( hosts="127.0.0.1:9639", timeout=4.0, # 连接超时时间 ) zk_client.start() zk_client.create("/pos/test", b"123") watch = zk_client.DataWatch("/pos/test") @watch def watch_node(data, stat): if data: return True return False os.system("echo wchp | nc 127.0.0.1 9639 | grep test")
print("wait...") time.sleep(1) zk_client.delete("/pos/test") time.sleep(1)
os.system("echo wchp | nc 127.0.0.1 9639 | grep test")
Logs with logging in DEBUG mode
COPY/PASTE the result of the snippet here (omit any sensitive information)
[root@03f25057-e68e-59ba-b542-1864ef50dcc0 ~]# python3.6 test.py
/pos/test
wait...
/pos/test
[root@03f25057-e68e-59ba-b542-1864ef50dcc0 ~]#
Specifications
- Kazoo version: 2.9.0
- Result of
pip listcommand: - Zookeeper version:3.7.1
- Zookeeper configuration: put here any useful ZK configuration (authentication, encryption, number of ZK members, number of (concurrent?) clients, Java version, krb5 version, etc.) [root@03f25057-e68e-59ba-b542-1864ef50dcc0 conf]# cat zoo.cfg autopurge.purgeInterval=1 initLimit=14 syncLimit=2 autopurge.snapRetainCount=40 skipACL=yes snapCount=39000 zookeeper.electionPortBindRetry=604800 [zookeeper]= 4lw.commands.whitelist=* tickTime=1500 dataDir=/opt/zookeeper/data reconfigEnabled=true dataLogDir=/opt/zookeeper/datalog cnxTimeout=100 preAllocSize=16384 standaloneEnabled=false dynamicConfigFile=/opt/java/zookeeper/conf/zoo.cfg.dynamic.10000000c3
[root@03f25057-e68e-59ba-b542-1864ef50dcc0 conf]# cat zoo.cfg.dynamic.10000000c3
server.1=10.28.112.50:2888:3888:participant;0.0.0.0:9639
- Python version:3.6
- OS: centos