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

Create a new LDAP client for each request and also close the connection. #9

Merged
merged 1 commit into from
May 17, 2015

Conversation

olesku
Copy link

@olesku olesku commented Apr 29, 2015

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 :)

@rlidwka
Copy link
Owner

rlidwka commented May 10, 2015

I'm happy to merge it, but just for completeness sake I'd like to repeat my question in a similar PR (#6 (comment)):

Is it possible to catch this particular error and re-connect to LDAP server when it happens instead of creating a separate request every time? Would it even make sense to maintain a permanent connection to LDAP server?

rlidwka added a commit that referenced this pull request May 17, 2015
Create a new LDAP client for each request and also close the connection.
@rlidwka rlidwka merged commit 2af5af9 into rlidwka:master May 17, 2015
@rlidwka
Copy link
Owner

rlidwka commented May 17, 2015

Merged and published as sinopia-ldap@0.5.0. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants