dubbo monitor报IOException: Packet len10110708 is out of range!

半兽人 发表于: 2019-03-14   最后更新时间: 2019-09-13 01:28:19   3,926 游览

我在启动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,如果是,就抛出异常。

发表于 2019-03-14

把默认的jute.maxbuffer大小提高

  1. 调整zookeeper服务端,在conf/zoo.cfg中增加jute.maxbuffer配置

    jute.maxbuffer=0x4ffffb0
    
  2. 顺便把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 "$@"
    
  3. 修改 dubbo-monitor-simple中bin/start.sh的启动参数,加上-Djute.maxbuffer,即可:

    JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djute.maxbuffer=0x4ffffb0 "
    

启动,一切正常了。

你的答案

查看java相关的其他问题或提一个您自己的问题