Create a new LDAP client for each request and also close the connection. #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After running for 20 minutes or so the plugin stopped working leaving us with this error:
err":{"message":"write after end","name":"Error","stack":"Error: write after end\n at writeAfterEnd (_stream_writable.js:167:12)\n at Socket.Writable.write (_stream_writable.js:214:5)\n at Socket.write (net.js:625:40)\n at Client._send (/usr/lib/node_modules/sinopia-ldap/node_modules/ldapjs/lib/client/client.js:914:17)\n at Client.search (/usr/lib/node_modules/sinopia-ldap/node_modules/ldapjs/lib/client/client.js:678:15)\n at /usr/lib/node_modules/sinopia-ldap/node_modules/ldapauth-fork/lib/ldapauth.js:197:23\n at LdapAuth._adminBind (/usr/lib/node_modules/sinopia-ldap/node_modules/ldapauth-fork/lib/ldapauth.js:165:12)\n at LdapAuth._search (/usr/lib/node_modules/sinopia-ldap/node_modules/ldapauth-fork/lib/ldapauth.js:193:8)\n at LdapAuth._findUser (/usr/lib/node_modules/sinopia-ldap/node_modules/ldapauth-fork/lib/ldapauth.js:242:8)\n at LdapAuth.authenticate (/usr/lib/node_modules/sinopia-ldap/node_modules/ldapauth-fork/lib/ldapauth.js:298:8)"},"msg":"LDAP error @{err}","time":"2015-04-29T09:01:05.022Z","v":0}
This problem goes away if you create a new ldap client instance for each query.
I've created a patch that solves this issue for us, pull if you like :)