question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Client warns in zookeeper on close

See original GitHub issue

Describe the bug When calling .close, zookeeper logs:

2021-04-02 10:48:23,605 [myid:1] - WARN  [NIOWorkerThread-2:NIOServerCnxn@364] - Unexpected exception
EndOfStreamException: Unable to read additional data from client, it probably closed the socket: address = /127.0.0.1:57980, session = 0x10094a0c40d0022
        at org.apache.zookeeper.server.NIOServerCnxn.handleFailedRead(NIOServerCnxn.java:163)
        at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:326)
        at org.apache.zookeeper.server.NIOServerCnxnFactory$IOWorkRequest.doWork(NIOServerCnxnFactory.java:522)
        at org.apache.zookeeper.server.WorkerService$ScheduledWorkRequest.run(WorkerService.java:154)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Is there a more graceful way to disconnect the client?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Stonocommented, Apr 2, 2021

@DavidVujic if it helps, I’m using ZK 2.6.2. This is the code i’m using to connect / execute / disconnect:

const config = {
        connect: process.env.ZOOKEEPER_HOST || `zookeeper:2181`,
        timeout: 5000,
        debug_level: constants.ZOO_LOG_LEVEL_WARN,
        host_order_deterministic: false
      }

      const client = new ZK(config)
      client.on('close', () => {
        this.logger.debug('close', `session closed, id=${client.client_id}`)
      })

      client.on('connecting', (): void => {
        this.logger.debug(
          'connecting',
          `session connecting, id=${client.client_id}`
        )
      })

      client.on('connect', (): void => {
        this.logger.debug('connect', `session connect, id=${client.client_id}`)
         // do some stuff, some get/set/create & mkdirp
         client.close()
      })
      client.init(config)
0reactions
DavidVujiccommented, Dec 28, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

zookeeper client close connection WARN · Issue #447 - GitHub
I wrote a test script that perform a zookeeper connection and exits without close connection and I get the same WARN.
Read more >
ZooKeeper keeps getting EndOfStreamException, causing a ...
I was able to solve the problem by deleting all zookeeper snapshots and log files from the server running ZooKeeper.
Read more >
zookeeper log full of WARN org.apache.zookeeper.se... - 44311
Does it cause any kind of issue? Looks like some kind of network connection issue, or maybe services are restarted. If connection are...
Read more >
the ZooKeeper command line interface
ZooKeeper -cli: the ZooKeeper command line interface. Pre-requisites. Enter into the ZooKeeper-cli. ```bash. connect to the localhost with the default port: ...
Read more >
Client warns in zookeeper on close - Bountysource
Describe the bug. When calling .close , zookeeper logs: 2021-04-02 10:48:23,605 [myid:1] - WARN [NIOWorkerThread-2:NIOServerCnxn@364] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found