I think you are trying to introduce a session expiration, then could you try to do the following and see if you can reproduce the session expiration?
./bin/kafka-server-start.sh config/server.properties kill -SIGSTOP <kafka_server_pid> sleep 6s At this point, the session will be expired and the node will disappear from zookeeper. Then you can do the following - kill -SIGCONT <kafka_server_pid> At this point, you should see the following log message from inside the handleNewSession() method - INFO re-registering broker info in ZK for broker 0 (kafka.server.KafkaHealthcheck) Hope that helps. Thanks, Neha On Mon, Mar 24, 2014 at 3:19 PM, Bae, Jae Hyeon <metac...@gmail.com> wrote: > Hi > > On zookeeper session timeout due to some stopping the world long GC pause > or zookeeper server outage, Ephemeral nodes on kafka broker and consumer > should be recreated but in my test environment, handleNewSession() is not > called. > > My test scenario is, starting kafka broker locally and put a breakpoint > somewhere to simulate long pause, and then, I expected handleNewSession() > should be called, but it was not and I saw kafka broker zk registration is > gone. > > Previously, to avoid this problem, I overrode zkclient implementation > internally to replace createEphemeral() function call with Apache Curator's > PersistentEphemeralNodes and for reinstating watchers, I implemented > ConnectionStateListener to reinstate all watchers when RECONNECTED happens. > > Do you know why I cannot reproduce handleNewSession()? > > Thank you > Best, Jae >