Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Adding patch for ldaps concurrent failures. #424

Closed
wants to merge 1 commit into from
Closed

Adding patch for ldaps concurrent failures. #424

wants to merge 1 commit into from

Conversation

renevo
Copy link

@renevo renevo commented Mar 11, 2017

As per issue #329 a race condition can occur that will emit events before the callback has had a chance to listen to them. We were able to replicate this about 60% of the time, causing timeout issues internally when in fact while looking at the trace logs, the search results returned.

Easiest to replicate with single result searches.

With these changes, we 100% verified that we no longer are missing events and it works as intended.

Thanks to @javefang for the fix!

As per issue #329 a race condition can occur that will emit events before the callback has had a chance to listen to them. We were able to replicate this about 60% of the time, causing timeout issues internally when in fact while looking at the trace logs, the search results returned.

Easiest to replicate with single result searches.

With these changes, we 100% verified that we no longer are missing events and it works as intended.

Thanks to @javefang for the fix!
@javefang
Copy link

Glad that you got this to work! Nice job, @pfmooney any chance you could take a look at this PR, please?

@javefang
Copy link

javefang commented Jun 1, 2017

Any chance we can merge this PR? Without it the ldaps:// protocol is not really usable.

@cvillemure
Copy link

I have the same issue with LDAP/TLS where about 1% of the search never receive the "end" event. This commit seems to fix the issue.

@rdubigny
Copy link

rdubigny commented Jan 16, 2018

Any chance to get this merged?

It worked like a charm on our project witch makes hundreds of concurrent call to our LDAP server.

As this project does not seems to be maintained any more, we will start using your fork from now.

@rdubigny
Copy link

@renevo can you publish your fork on npm?

@renevo
Copy link
Author

renevo commented Jan 24, 2018

Since this is "technically" managed by Joyent now, would want to find out if they are going to merge this or not first.

If not, will find out if we can.

@renevo
Copy link
Author

renevo commented Jan 24, 2018

@melloc thoughts?

@rdubigny
Copy link

rdubigny commented Feb 1, 2018

@renevo I will publish a fork from your repo since we need this on our project quite soon. I'll be glad to fetch your own publication if you publish it.

According to #461 , I don't expect an update on this repo.

@rdubigny
Copy link

rdubigny commented Feb 1, 2018

@renevo I just published the ldapjs-concurrency-fix package.

@melloc
Copy link
Collaborator

melloc commented Feb 1, 2018

@renevo Sorry for the delayed reply. I haven't had a chance since migrating this and several other packages over to go through all the pending merge requests and bugs, but I'd like to try to do so next week. Was there a reason you moved the writeCallback away from the .write() call? At first glance, I would expect it to not be called until the write succeeds.

@renevo
Copy link
Author

renevo commented Feb 5, 2018

The emitter was not able to be wired up properly due to not having been sent to the callback yet.

#329 explains this pretty well, the fix was to call the callback so the emitter can be listened, then actually send the request across the wire. (writeCallback, then send message)

@renevo
Copy link
Author

renevo commented Feb 5, 2018

This can be reproduced (in our case) by having an ldap search happen on a single connection through HTTP API over STARTTLS or TSL LDAP connection.

@renevo
Copy link
Author

renevo commented Apr 14, 2018

Any progress on this @melloc ?

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 new maintainer here. I want to merge this but I need to understand it better first. Some concerns:

  1. The original implementation is passing the write callback as the callback for the write (see: https://nodejs.org/dist/latest-v10.x/docs/api/net.html#net_socket_write_data_encoding_callback). It seems out of order to invoke the callback before the operation has completed. Is there not a more appropriate way to accomplish this goal?

  2. Would you be able to add a unit test for this functionality?

@jsumners jsumners added the closed-for-v2 Issues that were closed at the release of v2.0.0 but may still need to be addressed. label May 31, 2020
@jsumners jsumners closed this May 31, 2020
@jsumners
Copy link
Member

⚠️ 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.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed-for-v2 Issues that were closed at the release of v2.0.0 but may still need to be addressed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants