How/where to handle ESOCKET/ECONNRESET error
See original GitHub issueI tried to listen for error event, but as I saw in source code (tedious.js), ESOCKET event is ignored and nothing is emitted. I could see ECONNRESET in debug however. So how can I handle this event correctly? Occasionally this error occurs and then all requests are time-outed.
tedious.js
tedious.on('error', err => {
if (err.code === 'ESOCKET') {
tedious.hasError = true
return
}
this.emit('error', err)
})
if (this.config.debug) {
tedious.on('debug', this.emit.bind(this, 'debug', tedious))
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:16
Top Results From Across the Web
How do I debug error ECONNRESET in Node.js?
ECONNRESET occurs when the server side closes the TCP connection and your request to the server is not fulfilled. The server ...
Read more >Unable to catch ECONNRESET error and it is causing app to ...
I need some help as your documentation on Client Error handling seems to be gone. I've searched through forums and issues here.
Read more >How do I debug error ECONNRESET in Node.js?
“ECONNRESET” means the other side of the TCP conversation abruptly closed its end of the connection. This is most probably due to one...
Read more >Fixing an ECONNRESET error - Postman
The ECONRESET error means that the server unexpectedly closed the connection and the request to the server was not fulfilled. Connection-related ...
Read more >ECONNRESET on a reliable socket and now?
This requires to close the socket and create a new one to do the actual reconnect.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I this error when running larger queries, queries run fine in sql but lose connection when running through Transaction or Request
RequestError: Connection lost - read ECONNRESET
keepactive:true helps
I don’t think its for the library to be making calls on when to try to reconnect to the DB. If the initial probe connection fails there’s no reason to try again. When new connections are added to the pool they try to connect and if they fail the connection is discarded and a new one obtained until the pool is depleted of working connections. If no new connections can be established the pool becomes “unhealthy”. It’s up to the developer to decide how to handle unhealthy pools or individual connections that go bad.
I’m not sure this issue needs to be left open, I think it’s being handled as expected now.