Skip to content

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

Open
@Rylxnd

Description

@Rylxnd

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions