question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How/where to handle ESOCKET/ECONNRESET error

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:16

github_iconTop GitHub Comments

3reactions
ssontag55commented, Jun 11, 2019

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

2reactions
dhensbycommented, May 13, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found