[ 
https://issues.apache.org/jira/browse/DIRAPI-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16810741#comment-16810741
 ] 

Dom Gibson commented on DIRAPI-337:
-----------------------------------

This is occurring while I'm paging through a search, the connection isn't being 
closed on my end

 See below
{code:java}
while (true) {
        SearchRequest req = new SearchRequestImpl();
        req.setBase(new Dn(rootDn));
        req.setFilter("(objectclass=user)");
        req.setScope(SearchScope.SUBTREE);
        req.addAttributes(atts);
        req.addControl(pagedSearchControl);

        log.debug("Searching for all users on domain: {}", rootDn);
        try (SearchCursor searchCursor = connection.search(req)) {
                while (searchCursor.next()) {
                        Response response = searchCursor.get();
                        // process the SearchResultEntry
                        if (response instanceof SearchResultEntry) {
                                Entry entry = ((SearchResultEntry) 
response).getEntry();
                                if (entry != null) {
                                        log.trace("Checking user: {}", entry);
                                        processUserEntry(connection, entry, 
dbSpmIds);
                                }
                        }
                }
                SearchResultDone result = searchCursor.getSearchResultDone();
                pagedSearchControl = (PagedResults) 
result.getControl(PagedResults.OID);
                if (result.getLdapResult().getResultCode() == 
ResultCodeEnum.UNWILLING_TO_PERFORM) {
                        log.warn("LDAP Server does not handle paging");
                        return;
                }

        } catch (CursorException e) {
                log.error("{}", e.getMessage());
        }
        byte[] cookie = pagedSearchControl.getCookie();

        if (Strings.isEmpty(cookie)) {
                // If so, exit the loop
                break;
        }

        // Prepare the next iteration
        pagedSearchControl.setSize(1000);
}
{code}
 

 

 

> ClosedSelectorException while searching through LDAP
> ----------------------------------------------------
>
>                 Key: DIRAPI-337
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-337
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Dom Gibson
>            Priority: Major
>
> Getting the below stack trace several times randomly while searching through 
> LDAP.
>  
> java.nio.channels.ClosedSelectorException: null
> at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source) ~[na:1.8.0_171]
> at sun.nio.ch.SelectorImpl.select(Unknown Source) ~[na:1.8.0_171]
> at 
> org.apache.mina.transport.socket.nio.NioProcessor.select(NioProcessor.java:98)
>  ~[mina-core-2.0.16.jar!/:na]
> at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1075)
>  ~[mina-core-2.0.16.jar!/:na]
> at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
>  [mina-core-2.0.16.jar!/:na]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
> [na:1.8.0_171]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
> [na:1.8.0_171]
> at java.lang.Thread.run(Unknown Source) [na:1.8.0_171]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to