Mayvenn / embedded-kafka

Library to run in process Kafka broker
Eclipse Public License 1.0
16 stars 9 forks source link

zookeeper close connection when start broker #3

Open veerapatyok opened 6 years ago

veerapatyok commented 6 years ago

hi, I create api include kafka and I create test and use embedded kafka but I have a problem when I use

(ns ...
  (:require [embedded-kafka.core :as k])

(comment
 (def z (k/create-zookeeper))
   (def k (k/create-broker))
   (.startup k))

after that a zookeeper server close socket connection and then my repl close too.

my info log when start zookeeper

11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:java.io.tmpdir=/tmp
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:java.compiler=<NA>
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:os.name=Linux
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:os.arch=amd64
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:os.version=4.15.0-3-amd64
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:user.name=appsmith
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:user.home=/home/appsmith
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Server environment:user.dir=/home/appsmith/Desktop/project/tao2/winglue-well
11:49:28 INFO  o.a.zookeeper.server.ZooKeeperServer - Created server with tickTime 500 minSessionTimeout 1000 maxSessionTimeout 10000 datadir /tmp/embedded-kafka/zookeeper-snapshot/version-2 snapdir /tmp/embedded-kafka/zookeeper-log/version-2
11:49:28 INFO  o.a.z.server.NIOServerCnxnFactory - binding to port 0.0.0.0/0.0.0.0:2182
11:49:28 ERROR o.a.zookeeper.server.ZooKeeperServer - ZKShutdownHandler is not registered, so ZooKeeper server won't take any action on ERROR or SHUTDOWN server state changes

my info log when start broker

11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:java.io.tmpdir=/tmp
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:java.compiler=<NA>
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:os.name=Linux
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:os.arch=amd64
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:os.version=4.15.0-3-amd64
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:user.name=appsmith
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:user.home=/home/appsmith
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Client environment:user.dir=/home/appsmith/Desktop/project/tao2/winglue-well
11:49:34 INFO  org.apache.zookeeper.ZooKeeper - Initiating client connection, connectString=127.0.0.1:2182 sessionTimeout=6000 watcher=org.I0Itec.zkclient.ZkClient@5e4f74bd
11:49:34 INFO  org.I0Itec.zkclient.ZkClient - Waiting for keeper state SyncConnected
11:49:34 INFO  org.apache.zookeeper.ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:2182. Will not attempt to authenticate using SASL (unknown error)
11:49:34 INFO  o.a.z.server.NIOServerCnxnFactory - Accepted socket connection from /127.0.0.1:44038
11:49:34 INFO  org.apache.zookeeper.ClientCnxn - Socket connection established to 127.0.0.1/127.0.0.1:2182, initiating session
11:49:34 INFO  o.a.zookeeper.server.ZooKeeperServer - Client attempting to establish new session at /127.0.0.1:44038
11:49:34 INFO  o.a.z.server.persistence.FileTxnLog - Creating new log file: log.17
11:49:34 INFO  o.a.zookeeper.server.ZooKeeperServer - Established session 0x166ec80fc460000 with negotiated timeout 6000 for client /127.0.0.1:44038
11:49:34 INFO  org.apache.zookeeper.ClientCnxn - Session establishment complete on server 127.0.0.1/127.0.0.1:2182, sessionid = 0x166ec80fc460000, negotiated timeout = 6000
11:49:34 INFO  org.I0Itec.zkclient.ZkClient - zookeeper state changed (SyncConnected)
11:49:35 INFO  org.I0Itec.zkclient.ZkEventThread - Terminate ZkClient event thread.
11:49:35 INFO  o.a.z.server.PrepRequestProcessor - Processed session termination for sessionid: 0x166ec80fc460000
11:49:35 INFO  org.apache.zookeeper.ZooKeeper - Session: 0x166ec80fc460000 closed
11:49:35 INFO  o.a.zookeeper.server.NIOServerCnxn - Closed socket connection for client /127.0.0.1:44038 which had sessionid 0x166ec80fc460000
11:49:35 INFO  org.apache.zookeeper.ClientCnxn - EventThread shut down for session: 0x166ec80fc460000

How to fix this problem? Thank you

jeffh commented 6 years ago

Hey @veerapatyok, thanks for submitting an issue.

What does your list of dependencies look like? Are you using another version of kafka / zookeeper that the one that embedded-kafka depends on?

I'm just guessing that newer versions of ZK API now expects a shutdown handler that we're not providing.

Thanks, Jeff

veerapatyok commented 6 years ago

This is a list of dependencies I use I use kafka client version 1.1.0

[embedded-kafka "0.6.0"]
[org.apache.kafka/kafka-clients "1.1.0"]
[ovotech/kafka-avro-confluent "0.8.0" :exclusions [org.clojure/clojure]]
[org.apache.kafka/kafka-streams "1.1.0" :exclusions [org.rocksdb/rocksdbjni com.fasterxml.jackson.core/jackson-core]]
[io.confluent/kafka-avro-serializer "4.0.0" :exclusions [com.fasterxml.jackson.core/jackson-core]]
[io.confluent/common-config "4.0.0"]
[io.confluent/common-utils "4.0.0"]
[io.confluent/kafka-schema-registry-client "4.0.0" :exclusions [com.fasterxml.jackson.core/jackson-core]]
[io.confluent/kafka-streams-avro-serde "4.0.0" :exclusions [org.slf4j/slf4j-api com.fasterxml.jackson.core/jackson-core]]
veerapatyok commented 6 years ago

I solved this problem. I added [org.apache.kafka/kafka_2.12 "1.1.0"]

Thank you