我在启动dubbo-simple-monitor
时,启动不起来,一直刷Packet len10110708 is out of range!,详情如下:
java.io.IOException: Packet len10110708 is out of range!
at org.apache.zookeeper.ClientCnxn$SendThread.readLength(ClientCnxn.java:710)
at org.apache.zookeeper.ClientCnxn$SendThread.doIO(ClientCnxn.java:869)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1130)
2019-03-14 11:13:26,022 [main-SendThread(linux21-60:2181)] WARN org.apache.zookeeper.ClientCnxn$SendThread (ClientCnxn.java:1161) - Session 0x5697a1c9d390001 for server linux21-60/10.0.21.60:2181, unexpected error, closing socket connection and attempting reconnect
java.io.IOException: Packet len10110708 is out of range!
at org.apache.zookeeper.ClientCnxn$SendThread.readLength(ClientCnxn.java:710)
at org.apache.zookeeper.ClientCnxn$SendThread.doIO(ClientCnxn.java:869)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1130)
2019-03-14 11:13:27,290 [main-SendThread(linux21-60:2181)] WARN org.apache.zookeeper.ClientCnxn$SendThread (ClientCnxn.java:1161) - Session 0x5697a1c9d390001 for server linux21-60/10.0.21.60:2181, unexpected error, closing socket connection and attempting reconnect
java.io.IOException: Packet len10110708 is out of range!
at org.apache.zookeeper.ClientCnxn$SendThread.readLength(ClientCnxn.java:710)
at org.apache.zookeeper.ClientCnxn$SendThread.doIO(ClientCnxn.java:869)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1130)
通过查询源码,代码比较长,这里就不写了。大体逻辑就是,创建与zookeeper连接之后,要对某个节点进行读写操作,为了提高吞吐量,先判断下该节点数据量大小是否超过设置的jute.maxbuffer
,如果是,就抛出异常。
把默认的
jute.maxbuffer
大小提高调整zookeeper服务端,在
conf/zoo.cfg
中增加jute.maxbuffer
配置jute.maxbuffer=0x4ffffb0
顺便把zookeeper客户端也调整了,在
bin/zkCli.sh
增加-Djute.maxbuffer
。"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \ "-Djute.maxbuffer=83886000" \ -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \ org.apache.zookeeper.ZooKeeperMain "$@"
修改 dubbo-monitor-simple中
bin/start.sh
的启动参数,加上-Djute.maxbuffer
,即可:JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djute.maxbuffer=0x4ffffb0 "
启动,一切正常了。
你的答案