1

My NodeJS webserver is running in a docker container. The container is connected to another container which runs a MySQL server. Everything works fine for a while. But when I come back after a few days the server closed due to a connection error. At the moment I still don't understand why the MySQL server closed the connection. The serverlog also logged nothing suspicious.

I tried fixing it with a restart policy which works fine for me. But there must be a way to fix it properly.

events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: Connection lost: The server closed the connection.
    at Protocol.end (/usr/src/selg/node_modules/mysql/lib/protocol/Protocol.js:112:13)
    at Socket.<anonymous> (/usr/src/selg/node_modules/mysql/lib/Connection.js:97:28)
    at Socket.<anonymous> (/usr/src/selg/node_modules/mysql/lib/Connection.js:502:10)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! selg-final@1.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
  • 1
    and what is the mysql log at the same time of this issue ? – Mostafa Hussein Mar 14 '19 at 00:17
  • Possible duplicate of [nodejs mysql Error: Connection lost The server closed the connection](https://stackoverflow.com/questions/20210522/nodejs-mysql-error-connection-lost-the-server-closed-the-connection) – Mostafa Hussein Mar 14 '19 at 00:17

0 Answers0