ldapjs / node-ldapjs

LDAP Client and Server API for node.js
http://ldapjs.org
MIT License
1.61k stars 442 forks source link

ldapsearch TimeLimitExceeded #445

Closed JohnPolansky closed 5 years ago

JohnPolansky commented 7 years ago

Can anyone suggest what might be causing this error:

error:  origin=res.on, msg=LDAP_AD :: ldapSearch :Time Limit Exceeded
{ TimeLimitExceededError: Time Limit Exceeded
    at messageCallback (/node_modules/ldapjs/lib/client/client.js:1419:45)
    at Parser.onMessage (/node_modules/ldapjs/lib/client/client.js:1089:14)
    at emitOne (events.js:96:13)
    at Parser.emit (events.js:188:7)
    at Parser.write (/node_modules/ldapjs/lib/messages/parser.js:111:8)
    at end (/node_modules/ldapjs/lib/messages/parser.js:66:19)
    at Parser.write (/node_modules/ldapjs/lib/messages/parser.js:112:10)
    at TLSSocket.onData (/node_modules/ldapjs/lib/client/client.js:1076:22)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7) lde_message: 'Time Limit Exceeded', lde_dn: null }

It appears to happen on longer queries when we send thru multiple searches. If we send them one at a time they appear to work fine. When we try sending the same queries thru other tools like ldapsearch CLI they all appear to work and return in 20-30 seconds each. However the ldapjs appear to be returning this message back in less than 30 seconds. the idleTimeout connectTimeout and timeout are all set to well over 5 mins.

wcgcoder commented 7 years ago

Can reproduce this problem as well. idleTimeout, connectTimeout, and timeout are set extremely high (over 10 minutes).

I seem to get this TimeLimitExceededError after 10 seconds.

stern-shawn commented 6 years ago

EDIT:

Looking at the docs for .search(): timeLimit | the maximum amount of time the server should take in responding, in seconds. Defaults to 10. Lots of servers will ignore this.

Try manually setting this to a larger value in your options?

var opts = {
  filter: '(&(l=Seattle)(email=*@foo.com))',
  scope: 'sub',
  attributes: ['dn', 'sn', 'cn'],
  timeLimit: 6000, // 10 minutes in seconds or limit of your choice
};
jsumners commented 5 years ago

I believe this has been sufficiently answered. Feel free to re-open if you still have questions.

jsumners commented 1 year ago

⚠️ This issue has been locked due to age. If you have encountered a recent problem that seems to be covered by this issue, please open a new issue.

Please include a minimal reproducible example when opening a new issue.