Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read ECONNRESET after a few minutes idle #2794

Open
lijyze opened this issue Jun 21, 2024 · 1 comment
Open

Read ECONNRESET after a few minutes idle #2794

lijyze opened this issue Jun 21, 2024 · 1 comment

Comments

@lijyze
Copy link

lijyze commented Jun 21, 2024

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
Copy link
Author

lijyze commented Jun 21, 2024

Seems keepAliveInitialDelay cause this error, I have to pass a param to this config, and if I pass a small number, like keepAliveInitialDelay: 1, I also encounter this error. set it to 10000 seems work well.

Any explain about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant