ECONNRESET errors when idling
See original GitHub issueI’m trying to figure out the source of the error below, or how to catch it properly and mitigate it. I am using LDAPJS as part of an identity management pipeline to move user accounts from our ERP into Active Directory (connected over TLS with a self-signed cert). There is often idle periods in the database where no events are being dispatched, and in turn LDAPJS raises these exceptions when I assume it has nothing to do.
12:20:54 bsis-0 Error: read ECONNRESET
at exports._errnoException (util.js:812:11)
at TLSWrap.onread (net.js:542:26)
2015-11-03 12:20:54: App name:bsis id:0 exited with code 1
12:20:54 PM2 App name:bsis id:0 exited with code 1
2015-11-03 12:21:54: Starting execution sequence in -fork mode- for app name:bsis id:0
12:21:54 PM2 Starting execution sequence in -fork mode- for app name:bsis id:0
2015-11-03 12:21:54: App name:bsis id:0 online
12:21:54 PM2 App name:bsis id:0 online
12:21:54 bsis-0 WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
12:21:54 bsis-0 WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
12:37:54 bsis-0 Error: read ECONNRESET
at exports._errnoException (util.js:812:11)
at TLSWrap.onread (net.js:542:26)
2015-11-03 12:37:54: App name:bsis id:0 exited with code 1
12:37:54 PM2 App name:bsis id:0 exited with code 1
2015-11-03 12:38:54: Starting execution sequence in -fork mode- for app name:bsis id:0
12:38:54 PM2 Starting execution sequence in -fork mode- for app name:bsis id:0
2015-11-03 12:38:54: App name:bsis id:0 online
12:38:54 PM2 App name:bsis id:0 online
12:38:54 bsis-0 WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
12:38:54 bsis-0 WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
12:54:55 bsis-0 Error: read ECONNRESET
at exports._errnoException (util.js:812:11)
at TLSWrap.onread (net.js:542:26)
2015-11-03 12:54:55: App name:bsis id:0 exited with code 1
12:54:55 PM2 App name:bsis id:0 exited with code 1
They only show up because of my process.on('uncaughtException')
handler which in turns logs the event and then auto-restarts the broker.
Ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:30 (3 by maintainers)
Top Results From Across the Web
How do I debug error ECONNRESET in Node.js?
A break in the connection from the client throws the error ECONNRESET in Node. I believe this is ... This means that if...
Read more >ECONNRESET Errors - Potentially New Info & Questions - Help
I request you to kindly look for connections which are 'idle in transaction' and if you see that there are several such connections,...
Read more >MySQL giving "read ECONNRESET" error after idle ... - YouTube
MySQL : MySQL giving "read ECONNRESET " error after idle time on node.js server [ Beautify Your Computer ...
Read more >Addressing Networking Errors in a Microservice Based System
Resolving socket hang up and ECONNRESET errors in NodeJS ... (i.e. server closing the idle socket while the request is being sent).
Read more >cloud storage frequently throws ECONNRESET, read or write ...
Idling a google storage connection in an external VM (at travis-ci, via a service account) isn't recreating the storage API socket errors I...
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 FreeTop 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
Top GitHub Comments
👍
Thanks very much for doing the digging @tapmodo.
reconnect: true
does indeed auto-reconnect after this failure. This strikes me as a really important resilience feature so is a bit surprising it’s not documented. You do still need theclient.on('error', ...)
handler to stop the disconnection from bringing the process down first, as @pfmooney pointed out.So an over-simplified solution looks like:
Job done - thanks guys!
As noted above, the documentation for the Client API doesn’t mention auto-reconnecting or how to handle an eventual ECONNRESET from the server. I can’t imagine an LDAP server that never closes or resets the connection, or never goes down. Appears to be option
reconnect: true
?The documentation also does not mention how to close a connection, which is necessary if you are writing a small script that should gracefully shut down after doing its work. I looked in the source and appears this can be done with
client.destroy()
Both of these points would be useful to mention in the documentation. Thanks!