gheeres / node-activedirectory

ActiveDirectory is an Node.js ldapjs client for authN (authentication) and authZ (authorization) for Microsoft Active Directory with range retrieval support for large Active Directory installations.
MIT License
534 stars 146 forks source link

ECONNREFUSED on getGroupMembershipForDN() #209

Open CallSign-Filter opened 5 years ago

CallSign-Filter commented 5 years ago

I know this has been mentioned before in https://github.com/gheeres/node-activedirectory/issues/112 but I thought I would bring this to your attention. I was able to patch your code to make it work for all my users (with a performance hit). With our users who are in many groups they were unable to log in so I changed line 747 from: async.forEach(results, function(group, asyncCallback) { to: async.forEachLimit(results, 5, function(group, asyncCallback) {

This limits the pool so my users can log in instead of creating [up to] infinite pools and connections that just start getting dropped when there are too many created. If this was implemented you could have the limit as an opt that can be passed in by the user and set the default to something ridiculously high.

Really the underlying issue is that there is no limiting to how many connections and pools are created.