dsbenghe / Novell.Directory.Ldap.NETStandard

.NET LDAP client library for .NET Standard >= 2.0, .NET Core >=1.0, NET5/NET6/NET7/NET8 - works with any LDAP protocol compatible directory server (including Microsoft Active Directory).
MIT License
558 stars 153 forks source link

Fixed performance issue that came from 2.x - 3.x due to the way hops are done for referrals. #177

Closed danielDevelops closed 2 years ago

danielDevelops commented 3 years ago

changed hopcount to increment on each prior to each count rather than after for referrals

This fixes https://github.com/dsbenghe/Novell.Directory.Ldap.NETStandard/issues/176

dsbenghe commented 3 years ago

Can you explain how this fixes the performance problem you are mentioning?

Writing a test showing that would be best - you can use the run-opendj.bat to run opendj in docker. This is the way how the tests are run.

danielDevelops commented 2 years ago

Sorry, was on vacation and just got back to see this. The issue I found was that when it was trying to follow for referrals, it was timing out due to the environment. This was effectively causing the slowdowns since it had to wait for the timeout. That being said, the issue I found with the library was that it was still following for the referral even though it was disabled and when looking at the way the hops was happening it was based on the way the hop count was being calculated.

Specifically, if I set the hop count to zero, it will not exit the loop even though it shouldn't hop at all.

danielDevelops commented 2 years ago

upon some further research this is related to a bug in MS AD.

https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/ldap-paged-queries-subordinate-referrals-not-chased

dsbenghe commented 2 years ago

Closed as the issue was not as reported initially.