node-mysql2 icon indicating copy to clipboard operation
node-mysql2 copied to clipboard

Read ECONNRESET after a few minutes idle

Open lijyze opened this issue 8 months ago • 1 comments

It happens every first time my app interactive with database after a few minutes idle. I downgrade mysql2 to version v3.3.1, it seems work well. So I want to know if I need some additional config when use v3.10.1

Here is error log

QueryFailedError: read ECONNRESET
    at Query.onResult (F:\workspace\project\server\src\driver\mysql\MysqlQueryRunner.ts:246:33)
    at PoolConnection._notifyError (F:\workspace\project\server\node_modules\mysql2\lib\connection.js:228:21) 
    at PoolConnection._handleFatalError (F:\workspace\project\server\node_modules\mysql2\lib\connection.js:183:10)
    at PoolConnection._handleNetworkError (F:\workspace\project\server\node_modules\mysql2\lib\connection.js:196:10)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  query: 'SELECT `Admin`.`id` AS `Admin_id`, `Admin`.`adminName` AS `Admin_adminName`, `Admin`.`password` AS `Admin_password` FROM `admin` `Admin` WHERE ((`Admin`.`adminName` = ?)) LIMIT 1',
  parameters: [ 'lijyze' ],
  driverError: Error: read ECONNRESET
      at TCP.onStreamRead (node:internal/stream_base_commons:218:20) {
    errno: -4077,
    code: 'ECONNRESET',
    syscall: 'read',
    fatal: true
  },
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read',
  fatal: true
}

I have read #2599 but still feel confused. Any help would be appreciate!

lijyze avatar Jun 21 '24 11:06 lijyze