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

"Unhandled 'error' event" ECONNRESET after 2 minutes. #6

Closed
cepm-nate opened this issue Jan 17, 2018 · 1 comment
Closed

"Unhandled 'error' event" ECONNRESET after 2 minutes. #6

cepm-nate opened this issue Jan 17, 2018 · 1 comment

Comments

@cepm-nate
Copy link

Using your sample config, modified only to work with my LDAP server.
I then start it with node index.js and it says 'Listening on port: 12983' for two minutes. Then it crashes with

Listening on port: 12983
events.js:160
   throw er; // Unhandled 'error' event
   ^

Error: read ECONNRESET
  at exports._errnoException (util.js:1020:11)
  at TCP.onread (net.js:568:26)

This happens even if I don't query the API for authentication.

I've done a bunch of searching on Google but it all appears to be connected to timeouts with specific connections. This issue crashes the app even without me making any connections to the app API.

So if this is connection related, it must have to do with the LDAP connection. If so, what can I do with that connection to make it stay alive, or at least not crash the app?

@cepm-nate
Copy link
Author

cepm-nate commented Jan 18, 2018

Apparently this is known about, as seen at vesse/node-ldapauth-fork#23 and elsewhere

In my case I was able to catch the errors by modifying index.js and inserting the following code just after var auth = new LDapAuth(settings.ldap) call (near line 21).

// Catch errors so app does not crash
auth._adminClient.on('error', err => {
  console.warn('_adminClient: LDAP connection dropped, reconnecting.');
});
auth._userClient.on('error', err => {
  console.warn('_userClient: LDAP connection dropped, reconnecting.');
});

I'm not sure why the ldapauth-fork library doesn't already have a plan in place to catch errors.

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