kvspb / nginx-auth-ldap

LDAP authentication module for nginx
BSD 2-Clause "Simplified" License
735 stars 252 forks source link

Authentication timeout and segmentation fault fix on multiple, concurrent requests being processed at the same time #65

Closed pweiskircher closed 9 years ago

pweiskircher commented 9 years ago

We had the problem that whenever we ran multiple, concurrent requests nginx would report that for some requests the LDAP Authentication timed out and they would take at least 10 seconds to complete.

We found a couple of little problems with the async code that have been fixed here. We've been testing it for the last couple of weeks and it all seems to be working perfectly!

One problem was that sometimes it was assumed a LDAP request was sent already when it wasn't (because it couldn't get a LDAP connection).

Another problem was that in order for all of this to work, all the LDAP commands one request needs should be done on one LDAP connection one after the after - they are dependent on each other. But instead of trying to enforce that, it kept switching up between requests. This tries to make the LDAP connection more sticky to the request till it is done - but it is not enforcing it. It works well enough in practice, though.

This should fix #8, #36 and #56.

Thanks so much! Patrik