Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

protocol packets out of order

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 ?

Thank you

like image 529
Aaron Aben Danan Avatar asked Sep 10 '17 12:09

Aaron Aben Danan


1 Answers

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

max_allowed_packet=500M

like image 170
Igor Benikov Avatar answered Sep 17 '22 12:09

Igor Benikov