Zookeeper CLI failing - IOException Packet <len12343123123> is out of range

血红的双手。 提交于 2019-12-05 06:18:22

I was able to work around this by increasing the max size of my listing call.

I added the "-Djute.maxbuffer=50111000" to my zkCli.sh script so that it started the client using the following line:

$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
 "-Djute.maxbuffer=49107800" -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \
 org.apache.zookeeper.ZooKeeperMain "$@"

I was then able to list & use rmr /big/node

so, the problem was that the znode in question has been overwhelmed with sub-znodes. It had about 5 million of them. Zookeeper apparently does not like this. Even worse, there is no great way to clean it up. ZK should have a prune command (or something). Thanks for the answers.

Given the error line you mentioned,

707         void readLength() throws IOException {
708             int len = incomingBuffer.getInt();
709             if (len < 0 || len >= packetLen) {
710                 throw new IOException("Packet len" + len + " is out of range!");
711             }
712             incomingBuffer = ByteBuffer.allocate(len);
713         }

it may be that your packet length is larger than what jute.maxBuffer allows. The default value reads 4M, and that should suffice, but you may have defined the property with a sensibly lower value. In any case, do you have a very large number of children?

I had the same Packet out of range exception, but for a much silly reason. The port number I was specifying was for my solr instance and not the embedded zookeeper. I updated that to

bin/solr zk upconfig -z http://localhost:9983/ -n mynewconfig -d /path/to/configset where my instance is running on 8983.

Embedded zookeeper port defaults to localhost:(hostPort+1000)

Hope it helps anyone who is starting out like me.

In my case, this error was due to a "bugged" version of SolrCloud (4.8.0), upgrading to latest (4.8.1) the problem disappeared.

Have you tried to access it programmatically? Something like

ZooKeeper zooKeeper = new ZooKeeper(hostPort, 3000, myWatcher);
String path = "/myznode/subznode"
List<String> children = zooKeeper.getChildren(path, false);
for (String child : children) {
    System.out.println(child);
}

I had a similar problem and I was able to fix it by fixing the zookeeper ports to 2181

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!