Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATAL ERROR: 'PROTOCOL_PACKETS_OUT_OF_ORDER' Got: 0, Expected: 17. #2534

Open
Rylxnd opened this issue Nov 26, 2021 · 2 comments
Open

FATAL ERROR: 'PROTOCOL_PACKETS_OUT_OF_ORDER' Got: 0, Expected: 17. #2534

Rylxnd opened this issue Nov 26, 2021 · 2 comments

Comments

@Rylxnd
Copy link

Rylxnd commented Nov 26, 2021

I have been having this issue all the time with my server. I just could never find a solution to my probleme. Here is the error I am getting:

events.js:353
      throw er; // Unhandled 'error' event
      ^

Error: Packets out of order. Got: 0 Expected: 17
    at Parser._tryReadPacketHeader (G:\webserver\node_modules\mysql\lib\protocol\Parser.js:470:15)      
    at Parser.write (G:\webserver\node_modules\mysql\lib\protocol\Parser.js:33:29)
    at Protocol.write (G:\webserver\node_modules\mysql\lib\protocol\Protocol.js:38:16)
    at Socket.<anonymous> (G:\webserver\node_modules\mysql\lib\Connection.js:88:28)
    at Socket.<anonymous> (G:\webserver\node_modules\mysql\lib\Connection.js:526:10)
    at Socket.emit (events.js:376:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Emitted 'error' event on Connection instance at:
    at Connection._handleProtocolError (G:\webserver\node_modules\mysql\lib\Connection.js:423:8)        
    at Protocol.emit (events.js:376:20)
    at Protocol._delegateError (G:\webserver\node_modules\mysql\lib\protocol\Protocol.js:398:10)        
    at Protocol.handleParserError (G:\webserver\node_modules\mysql\lib\protocol\Protocol.js:380:10)     
    at Parser._tryReadPacketHeader (G:\webserver\node_modules\mysql\lib\protocol\Parser.js:478:10)      
    at Parser.write (G:\webserver\node_modules\mysql\lib\protocol\Parser.js:33:29)
    [... lines matching original stack trace ...]
    at Socket.emit (events.js:376:20) {
  code: 'PROTOCOL_PACKETS_OUT_OF_ORDER',
  fatal: true
}

Here is my connection (self made mini sql module):

const mysql = require('mysql')


class Database {
    constructor( config ) {
        this.connection = mysql.createConnection( config )
    }
    query( sql, args ) {
        return new Promise((resolve, reject) => {
            this.connection.query( sql, args, (err, res ) => {
                if (err) {return reject(err);};
                resolve(res)
            })
        })
    }
    end() {
        return new Promise((resolve, reject) => {
            this.connection.end(err => {
                if (err) {return reject(err);}

                resolve()
            })
        })
    }

}

module.exports = Database;

I only ever make one connection. Is this my problem?

@Voznov
Copy link

Voznov commented Nov 27, 2021

I have the same problem. I set the connection to the base, sent a couple of requests and everything worked. After some time of inaction led to this error.
[email protected] (github:mysqljs/mysql#3430c513d6b0ca279fb7c79b210c9301e9315658)

@how1231
Copy link

how1231 commented Dec 25, 2021

@TheRyGuy2008 I had the same problem. But once I change my connection from mysql.createConnection to mysql.createPool, the error never happen again...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants