1

I have made as realtime Node.js application.I am using mysql2 database.

Server start with:- pm2 start app

The next day, my server is not responding. And I got this error

Warning: got packets out of order. Expected 2 but received 0

Error: Can't add new command when connection is in closed state
at Connection._addCommandClosedState 
(/var/www/html/main/node_modules/mysql2/lib/connection.js:148:17)
at Connection.query (/var/www/html/main/node_modules/mysql2/lib/connection.js:546:17)
at internal/util.js:340:30
at new Promise (<anonymous>)
at Connection.query (internal/util.js:339:12)
at Object.setBattleDetails (/var/www/html/main/Models/updateScore.js:36:30)
at Socket.matchStarted (/var/www/html/main/Controllers/PlayerMatching.js:142:52)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
fatal: true
}

How to resolve this error?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Manish Rai
  • 21
  • 1
  • 5
  • i have same issue , ```Warning: got packets out of order. Expected 2 but received 1``` but i dunno where is the error line and there is no report from users. and nothing happened on server. – Yogi Arif Widodo Oct 14 '22 at 09:37

0 Answers0