packet len* is out of range!

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了packet len* is out of range!相关的知识,希望对你有一定的参考价值。

参考技术A 项目使用的是 dubbo 框架, 注册中心使用的是 zookeeper。项目自发布以来平稳迭代运行了18个月,但在某个周五,正等待下班之际,突然传出噩耗,app打开非常卡顿且有大量报错。20分钟之后,网关服务(consumer)宕机了。

网关服务器cpu爆了。
通过 netstat -anp|grep port 查看发现有大量的 TIME_WAIT 的线程。

搜寻网关日志,重点发现有两个报错:

上网搜了很多,都说是要增加 jute.maxbuffe 参数,通过本人亲自验证,确实如此。

1、server端:修改 zkServer.sh 启动脚本文件,设置增加内存 jute.maxbuffer 为 10M ,重启zk使配置生效:

2、client端:修改网关服务(consumer)启动脚本文件,增加参数
JAVA_OPTS=" -Djute.maxbuffer=10240000 [其他参数xxxxxxxx]"

MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误

报错信息:

PHP Warning:  Packets out of order. Expected 1 received 56. Packet size=3420216 in /data/bogiang/test/EC/swoole_process.php on line 62

Warning: Packets out of order. Expected 1 received 56. Packet size=3420216 in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Warning:  PDO::query(): MySQL server has gone away in /data/bogiang/test/EC/swoole_process.php on line 62

Warning: PDO::query(): MySQL server has gone away in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Warning:  PDO::query(): Error reading result set\'s header in /data/bogiang/test/EC/swoole_process.php on line 62

Warning: PDO::query(): Error reading result set\'s header in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Fatal error:  Uncaught Error: Call to a member function fetchAll() on bool in /data/bogiang/test/EC/swoole_process.php:63
Stack trace:
#0 [internal function]: {closure}(Object(Swoole\\Process))
#1 /data/bogiang/test/EC/swoole_process.php(67): Swoole\\Process->start()
#2 {main}
  thrown in /data/bogiang/test/EC/swoole_process.php on line 63

Fatal error: Uncaught Error: Call to a member function fetchAll() on bool in /data/bogiang/test/EC/swoole_process.php:63
Stack trace:
#0 [internal function]: {closure}(Object(Swoole\\Process))
#1 /data/bogiang/test/EC/swoole_process.php(67): Swoole\\Process->start()
#2 {main}
  thrown in /data/bogiang/test/EC/swoole_process.php on line 63

造成原因:

image
多进程使用同一个mysql链接导致出来的。

为什么会出现这问题:

1.多进程中MYSQL不可以使用同一个链接
2.如果使用需要一个连接池

网上查看了几篇报错的原因:
Thinkphp5框架使用swoole,数据连接报Packets out of order.
PHP MYSQL Packets out of order. Expected 1 received 0. Packet size=
为什么DB连接管理一般不采用IO多路复用?

解决问题:

1、在每个进程里进行链接mysql
2、使用连接池,避免这个问题
php搭建mysql连接池

以上是关于packet len* is out of range!的主要内容,如果未能解决你的问题,请参考以下文章

MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误

Excel excel ran out of resources是啥意思

为啥我在读取空文件时收到“Pickle - EOFError: Ran out of input”?

8623错误:The query processor ran out of internal resources and could not pro

SQL Server捕获发生The query processor ran out of internal resources and could not produce a query plan..

解决:magic_number = pickle_module.load(f, **pickle_load_args)EOFError: Ran out of input