instaclustr / cassandra-ldap

LDAP Authenticator for Apache Cassandra
Apache License 2.0
24 stars 16 forks source link

Connection timeout issue for local user authentication when there are many parallel connections #26

Closed piyengarr closed 2 years ago

piyengarr commented 2 years ago

We experienced connection timeout issues for local user authentication, when there were many parallel connections, with LDAPAuthenticator.

On further investigation, we found that the auth requests are not actually executing in parallel, as the methods on a static HasherImpl instance in LDAPAuthenticator were being synchronized. These methods need not be synchronized as there is no shared data that they are operating on. So, we removed synchronization, after which our auths started succeeding

smiklosovic commented 2 years ago

@piyengarr great! Thank you very much for this. I ll take a look and release.

smiklosovic commented 2 years ago

@piyengarr do I understand it right that by merging this change, your problems went away completely?

piyengarr commented 2 years ago

Yes, that is correct.

To give more context, when PasswordAuthenticator was used on the same system, local authentications were succeeding. But when we switched to LDAPAuthenticator, 4 to 5 auths out of say 30 would timeout. This was consistently reproducible. These auths were simple cqlsh login shell commands.

smiklosovic commented 2 years ago

@piyengarr what Cassandra version do you use?

piyengarr commented 2 years ago

@smiklosovic 3.11.12