nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 282 forks source link

read ECONNRESET at TCP.onStreamRead #3974

Closed C0casio45 closed 2 years ago

C0casio45 commented 2 years ago

Details

I'm running a bot and I'm getting this error from 1 to two times a day

Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:211:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read',
  fatal: true
}

Node.js version

16.6.1

Example code

I have no idea where it comes from https://github.com/C0casio45/bot_onet

Operating system

debian

Scope

runtime (prod)

Module and version

mysql or discordjs

ntfargo commented 2 years ago

MySQL does remove unused connections. The default timeout is 8 hours. Use show variables like 'wait_timeout'; to view current timeout settings, and try edit to set wait_timeout=31536000; 365 day / 1 year.

C0casio45 commented 2 years ago

Thanks a lot, I'll wheck this right now and if it's work I will close this issue

C0casio45 commented 2 years ago

Ok so it works but set wait_timeout is great on session only If you want to set wait_timeout globally, you need to go in /etc/mysql and add the following lines

[mysqld]
wait_timeout=31536000
interactive_timeout =31536000