Open HarlemSquirrel opened 3 years ago
Could you provide more details about the way you're using the control? In particular:
Is the request control critical or non-critical? If you don't explicitly specify the criticality, then the LDAP SDK will create it as non-critical, and in that case, the sever can decide to treat it as optional and ignore it if it can't process it for some reason. Since you say that the server is returning more results than the specified page size, then it might be that it's ignoring the control and just processing it as a non-paged search.
Does the failure always occur on the attempt to return the second page of results, or are you able to get multiple pages of results before you encounter the failure?
How are you getting the cookie that you're including in the control? Are you making sure that the cookie is null when trying to retrieve the first page, and then for each subsequent page, you're providing the cookie you got in the result to the search that got the previous page?
Are you using a connection pool or a single connection? If you're using a connection pool, are you issuing requests against the pool itself or by checking out a connection and using it? Is it possible that the requests to retrieve different pages could be issued over different connections? Some servers might only support paging through search results when you try to use the same connection for all pages.
Also, the error message is being returned by the server,, and it might be a server-side issue rather than a client-side one. I would recommend checking its logs or other diagnostic information to see if there is anything there that might help provide more information about what's happening.
Hi dirmgr,
I did try with both critical and non critical and got the same issue.
The failure does seem to always happen at the first request with a cookie.
Here's an excerpt of the test code I'm using to replicate the issue.
while(true) {
searchRequest.setControls(new SimplePagedResultsControl(100, resumeCookie));
SearchResult results = conn().search(searchRequest);
numSearches++;
totalEntriesReturned += results.getEntryCount();
entries.addAll(results.getSearchEntries());
SimplePagedResultsControl responseControl =SimplePagedResultsControl.get(results);
if (responseControl.moreResultsToReturn())
{
resumeCookie = responseControl.getCookie();
System.out.println("Paged cookie: " + resumeCookie);
}
else
{
break;
}
}
I've tried both connection pool and single connection and that doesn't seem to matter.
I'm going to see if I can put together an easy to replicate environment for debugging.
Thank you for the quick response!
When using
SimplePagedResultsControl
, OpenLDAP 2.4 returns more entries than the set page size and the next request fails with "paged results cookie is invalid".