New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermediate responses #28
Comments
Heh, I knew that someday someone was going to try using the crate for persistent search, and that I'd be writing a "dog ate my homework" reply 🙂 You're not missing anything, I simply never got around to writing support for persistent searches. While it's true that a persistent search looks like a streaming Search if you squint hard enough, the latter wasn't written with the former in mind, so details like controls attached to SearchResultEntry PDUs and empty SREs for cookie/phase updates aren't handled at all. I'd be interested in seeing the network packet trace of a stuck search. I suspect that the server is sending replies, but the driver is mishandling them in some way and not sending anything back to the requester. Minimal Sync support, returning initial results and added/updated entries within a streaming Search, should be possible without much trouble, or so I hope. Better support would require either a custom persistent request, or returning raw entries from a streaming Search. |
The communication is over TLS, is there any way to capture the dump at the protocol level? EDIT: Oh wait, I have the server's key :) I'll try capturing some traces for you with wireshark |
I managed to get a nice trace, but its a bit sensitive so I redacted it a bit. What happens is after I start search with LdapConn::streaming_search(), passing itSyncRequestControl specifying mode of refresh and persist, no cookie and default reload hint of false:
I get lots of search result entries with Sync State Control as expected and then an intermediate response of 1.3.6.1.4.1.4203.1.9.1.4 (marking end of the initial sync phase and start of update notifications) upon which client just drops the TCP connection and hangs. My code is still blocking inside the EntryStream::next() and has no idea something happened. I think all that short term solution for now is for the client to not die on the intermediate response - it may even swallow it and continue sending entries on changes - as long as we can get a way to somehow get at the controls of the returned entries to get the type of change (present/add/modify/delete) from Sync State Control... So changes needed are:
|
Thanks, that was informative and it confirmed my suspicion that the driver is choking on Intermediate responses. Try the search after applying this patch:
It's a gross hack which will discard Intermediate responses, but also continue receiving search results while the operation is active. Sync State controls and Sync Info messages are still unavailable, although addition, modification and even deletion of individual entries can be recognized. I'll start working on a better solution once I publish the long overdue v0.6 of the crate. |
That works, alright. I am receiving updates and it does not die 👍 Up with the 0.6!!!! |
Ugly hack or not, its still better than a crash and it works! |
(Sorry for the delay, I've been rather busy.) Please keep using the patch for a while, I really don't want to have nasty hacks, however minimal, in the published versions of the crate. A proper fix is coming along. |
Any progress? Would love to use official crate instead of hacked one... |
Alright, since you clearly have no time/motivation for this, would you let me help you with it? |
It's more time than motivation (as you can see, my response time is atrocious atm), but it's true that I've been waiting for the async design to settle, probably at the detriment of useful work. So, go for it. My only guideline would be that I'd prefer the existing API to remain unchanged, which also means keeping things like |
Having looked at the code in depth, I can see this crate is in need of serious rewrite and now understand why you don't want to spend time updating it to run with recent tokio with async/await requiring another rewrite around the corner. Unfortunate. |
Okay. Now we have Futures 0.3, async/await, and tokio 0.2. |
... and it's done, mirabile dictu. All sync-related messages and controls can now be captured by user code. |
Amazing! :) Will try... |
An example of persistent search would be really nice. Right now this issue and the |
All examples distributed with the library are meant to work with OpenLDAP initialized from the |
@StarlessNights Addendum: persistent search is this. From your mention of |
@inejge Ahh right you are. Thanks for the clarification. |
Hi,
I'm trying to make synchronization work using the sync request control of RFC4533 (1.3.6.1.4.1.4203.1.9.1.1).
So far I have managed to create the custom control and pass it to streaming_search().
As expected, initial results are returned and search does not end because SearchResultDone message is not sent, but I'm missing a way to receive the intermediate Sync Info Message that should be sent at this point, and I don't receive any changed entries upon changes in LDAP data. No error is returned. The stream seems to be stuck.
Am I missing something?
(I'm willing to help with this, and possibly with making more controls/ASN.1 stuff)
The text was updated successfully, but these errors were encountered: