samuel / go-zookeeper

Native ZooKeeper client for Go. This project is no longer maintained. Please use https://github.com/go-zookeeper/zk instead.
BSD 3-Clause "New" or "Revised" License
1.64k stars 672 forks source link

Issue related with zookeeper old client #244

Open cnutshell opened 4 years ago

cnutshell commented 4 years ago

In zookeeper 3.4.5, If zookeeper service discover an old client, it would close that connection directly without any response, which would result endless reconnection from client to zookeeper service. Client binding would get EOF when reading from that connection. This EOF got by client should be considered as ErrSessionExpired.

cnutshell commented 4 years ago

Log of testing client taking use of log extensional binding:

2020/04/18 15:46:00 [20] authenticate: fail to read len data
2020/04/18 15:46:00 [20] loop: After authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:00 [20] loop: authentication failed: EOF
2020/04/18 15:46:00 [20] loop: exit from send/recv loop
2020/04/18 15:46:00 [20] loop: enter next processing
2020/04/18 15:46:00 [20] connect: Connected to 172.22.136.96:2181
2020/04/18 15:46:00 [20] loop: Before authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:00 [20] authenticate: fail to read len data
2020/04/18 15:46:00 [20] loop: After authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:00 [20] loop: authentication failed: EOF
2020/04/18 15:46:00 [20] loop: exit from send/recv loop
2020/04/18 15:46:00 [20] loop: enter next processing
2020/04/18 15:46:00 [20] connect: Connected to 172.22.135.139:2181
2020/04/18 15:46:00 [20] loop: Before authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:00 [20] authenticate: fail to read len data
2020/04/18 15:46:00 [20] loop: After authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:00 [20] loop: authentication failed: EOF
2020/04/18 15:46:00 [20] loop: exit from send/recv loop
2020/04/18 15:46:00 [20] loop: enter next processing
2020/04/18 15:46:00 [15] sendLoop: send ping packet
2020/04/18 15:46:01 [20] connect: retryStart triggered
2020/04/18 15:46:01 [20] connect: Connected to 172.22.135.140:2181
2020/04/18 15:46:01 [20] loop: Before authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:01 [20] authenticate: fail to read len data
2020/04/18 15:46:01 [20] loop: After authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:01 [20] loop: authentication failed: EOF
2020/04/18 15:46:01 [20] loop: exit from send/recv loop
2020/04/18 15:46:01 [20] loop: enter next processing
2020/04/18 15:46:01 [20] connect: Connected to 172.22.136.96:2181
2020/04/18 15:46:01 [20] loop: Before authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:01 [20] authenticate: fail to read len data
2020/04/18 15:46:01 [20] loop: After authenticate: LastZxidSeen=30064771079, TimeOut=4000, SessionID=31960860706013185, Passwd='^@¸¡æ^V®ä<80>^HÿðP<83>÷Øø'
2020/04/18 15:46:01 [20] loop: authentication failed: EOF
2020/04/18 15:46:01 [20] loop: exit from send/recv loop
2020/04/18 15:46:01 [20] loop: enter next processing

Zookeeper service log for old client:

2020-04-18 15:45:58,885 [myid:2] - WARN  [NIOServerCxn.Factory:/172.22.136.96:2181:ZooKeeperServer@809] - Connection request from old client /192.168.168.157:65299; will be dropped if server is in r-o mode
2020-04-18 15:46:00,106 [myid:2] - WARN  [NIOServerCxn.Factory:/172.22.136.96:2181:ZooKeeperServer@809] - Connection request from old client /192.168.168.157:65302; will be dropped if server is in r-o mode
2020-04-18 15:46:01,327 [myid:2] - WARN  [NIOServerCxn.Factory:/172.22.136.96:2181:ZooKeeperServer@809] - Connection request from old client /192.168.168.157:65305; will be dropped if server is in r-o mode

Zookeeper Version:

zookeeper 3.4.5