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?