Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Cannot start Zookeeper due to: Exception causing close of session 0x0 due to java.io.EOFException

Ask Question

I am trying to start up Zookeeper via the CLI with the command:

bin/zookeeper-server-start.sh ../config/zookeeper.properties

And it hums along for a second with what all seems to be correct until it says this:

INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)

and then the below loops indefinitely until I exit:

 [2018-08-10 15:07:48,223] INFO Accepted socket connection from /172.31.39.32:46374 (org.apache.zookeeper.server.NIOServerCnxnFactory)
    [2018-08-10 15:07:48,228] WARN Exception causing close of session 0x0 due to java.io.IOException: ZooKeeperServer not running (org.apache.zookeeper.server.NIOServerCnxn)
    [2018-08-10 15:07:48,228] INFO Closed socket connection for client /172.31.39.32:46374 (no session established for client) (org.apache.zookeeper.server.NIOServerCnxn)

This is a single server and I believe a single node test server, so there isn't a quorum or other pieces running. My zookeeper config is basic, it only contains this:

dataDir=/tmp/zookeeper
clientPort=2181
maxClientCnxns=0

The weird thing is, my zookeeper had been running fine, and I had made NO changes to the config. Pulled it down to try to fix something else to do a quick restart on the zookeeper, and it won't budge. I've checked, and nothing else is running on port 2181.

I see this question has been asked several times with no answers, any ideas?

This might be happening because of some corruption in zookeeper data. You should not set dataDir to /tmp/*. If your computer purges some data of /tmp, it will be difficult for zookeeper to restore the state upon restart. If you check the zookeeper logs, you should see some kind of exception there.

Since you mentioned this zookeeper instance is for test purpose only. You should set dataDir to anything but /tmp and try restart.

That actually could be it. We keep our Kafka as a very "temp" storage in our architecture, so we purposefully want it cleared upon every startup. We had an issue the other day where it didn't clear, and went in and cleared some topics manually, and I think it may have led to some corruption. As even though we have the delete.topic.enabled=true settings, we see all of our day old (or longer) topics present, but marked for deletion, though they never get deleted – NateH06 Aug 13, 2018 at 14:43 @NateH06 May be you should do it via some script/code at restart. If you do not want data from previous run then it is not a problem of restart. You can just clean zookeeper and kafka completely (i.e. by deleting log directory and other metadata) so that each restart is a new instance instead of depending on /tmp to clear it for you. – mrnakumar Aug 13, 2018 at 18:41

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.