协议包乱序 [英] protocol packets out of order

查看:72
本文介绍了协议包乱序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在 A2 Hosting 上上传了我的 node.js 应用程序,但出现此错误:

I recently uploaded my node.js app on A2 Hosting and I get this error :

{ Error: Packets out of order. Got: 80 Expected: 0
    at Parser.write (/home/westudec/public_html/myapp/node_modules/mysql/lib/protocol/Parser.js:42:19)
    at Protocol.write (/home/westudec/public_html/myapp/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/home/westudec/public_html/myapp/node_modules/mysql/lib/Connection.js:103:28)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:547:20)
    --------------------
    at Protocol._enqueue (/home/westudec/public_html/myapp/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Protocol.handshake (/home/westudec/public_html/myapp/node_modules/mysql/lib/protocol/Protocol.js:52:23)
    at Connection.connect (/home/westudec/public_html/myapp/node_modules/mysql/lib/Connection.js:130:18)
    at Object.<anonymous> (/home/westudec/public_html/myapp/app2.js:22:7)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10) code: 'PROTOCOL_PACKETS_OUT_OF_ORDER', fatal: true }

我从这段代码中得到这个错误:

I get that error from this code :

var connection = mysql.createConnection(connDB);
connection.connect();
connection.query(`SELECT * FROM action`, function(err, data){
    if(err) return console.error(err);
    else {
        console.log("data : ", data);
    }
})

在我的本地主机上它工作得很好,但在服务器上我得到了那个错误.关于此错误的文档非常糟糕.有人有想法吗?

On my localhost it works perfectly but on the server I get that error. The documentation about this error is very poor. Does someone have an idea ?

谢谢

推荐答案

你需要在mysql配置文件(my.cnf)中增加mysql max_allowed_pa​​cket参数,方法如下:

You need to increase mysql max_allowed_packet parameter in mysql configuration file (my.cnf) by the next way:

max_allowed_pa​​cket=500M

这篇关于协议包乱序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆