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.

A zookeeper command is limited to 8KB.

See original GitHub issue

When issuing a command, the output on the socket is truncated at 8KB.

zk = KazooClient()
buf = zk.command("stat")

Perhaps you could read from the socket until the socket is drained rather than truncating to only 8KB of data from the socket? https://github.com/python-zk/kazoo/blob/4d268adf9837836f05dde5ec81be0d7bbd759e78/kazoo/client.py#L653

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
brouberolcommented, Nov 14, 2017

I stumbled upon the same issue today, as I was trying to parse the cons output, and was missing some data.

To bypass the 8192 char limit, I overrode my client command method with

def command(self, cmd='ruok'):
    """Sends a commmand to the ZK node.

    Overrides methode defined at
    https://github.com/python-zk/kazoo/blob/release/2.4/kazoo/client.py#L637
    as it could leave some data unread from the socket.

    """
    if not self._live.is_set():
        raise ConnectionLoss("No connection to server")
    out = []
    peer = self._connection._socket.getpeername()
    sock = self.handler.create_connection(
        peer, timeout=self._session_timeout / 1000.0)
    sock.sendall(cmd)
    while True:
        data = sock.recv(8192)
        if not data:
            break
        out.append(data)

    sock.close()
    result = b''.join(out)
    return result.decode('utf-8', 'replace')
0reactions
StephenSorriauxcommented, Sep 23, 2021

Hi,

Yes we would definitely accept PRs for this. I guess the addition of a new kwarg to https://github.com/python-zk/kazoo/blob/master/kazoo/client.py#L705 in order to make the size adjustable, with a default value to the current one, seems safe. But any better ideas are welcomed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ZooKeeper Administrator's Guide - Apache ZooKeeper
This section contains information about deploying Zookeeper and covers these topics: System Requirements. Clustered (Multi-Server) Setup.
Read more >
Kafka 3.3 Documentation
Apache Kafka can be started using ZooKeeper or KRaft. To get started with either configuration follow one the sections below but not both....
Read more >
Kafka 2.5 Documentation
NOTE: Your local environment must have Java 8+ installed. Run the following commands in order to start all services in the correct order:...
Read more >
Kafka 1.1 Documentation
Kafka uses ZooKeeper so you need to first start a ZooKeeper server if you ... A more limited legacy producer and consumer api...
Read more >
Kafka 2.7 Documentation
NOTE: Your local environment must have Java 8+ installed. Run the following commands in order to start all services in the correct order:...
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