Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 9285 invoked from network); 21 Apr 2007 11:08:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Apr 2007 11:08:38 -0000 Received: (qmail 40578 invoked by uid 500); 21 Apr 2007 11:08:44 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 40355 invoked by uid 500); 21 Apr 2007 11:08:43 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 40331 invoked by uid 99); 21 Apr 2007 11:08:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Apr 2007 04:08:43 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Apr 2007 04:08:36 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0533D71406C for ; Sat, 21 Apr 2007 04:08:16 -0700 (PDT) Message-ID: <20721657.1177153696018.JavaMail.jira@brutus> Date: Sat, 21 Apr 2007 04:08:16 -0700 (PDT) From: "Emmanuel Lecharny (JIRA)" To: dev@directory.apache.org Subject: [jira] Closed: (DIRSERVER-391) Loop in client results in NPE + CommunicationException Request: 1 cancelled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DIRSERVER-391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Emmanuel Lecharny closed DIRSERVER-391. --------------------------------------- Closing all issues created in 2005 and before which are marked resolved > Loop in client results in NPE + CommunicationException Request: 1 cancelled > --------------------------------------------------------------------------- > > Key: DIRSERVER-391 > URL: https://issues.apache.org/jira/browse/DIRSERVER-391 > Project: Directory ApacheDS > Issue Type: Bug > Environment: Windows XP SP2, JDK1.4.2_05, Running the program in Eclipse 3.0.1 > Reporter: David Geleyn > Assigned To: Alex Karasulu > Attachments: Test.java > > > The source code that fails is too complicated to add here, so I've made a test program that results in the same behaviour. > This program doesn't do anything useful. It checks twice whether Alex Karasulu is an administrator and repeats this for a thousand times. It results in an CommunicationException at client side and a NPE at server side. I added both stacktraces at the end. I also added the code that starts up the LDAP server. > I googled to find some explanation for the "Request 1: Cancelled", but I didn't find an useful explanation. There was some topic on a forum that mentionned that the number of connections was reached. Can this be the problem? > After the NPE (which is never a good thing), new server requests will be processed. It's only the thread that handles the request that fails (i guess). > ============= SAMPLE CLIENT CODE > public static void main(String[] args) throws Exception > { > final Properties env = new Properties(); > env.put(Context.INITIAL_CONTEXT_FACTORY, > "com.sun.jndi.ldap.LdapCtxFactory"); > env.put(Context.PROVIDER_URL, "ldap://david:389"); > env.put(Context.SECURITY_AUTHENTICATION, "simple"); > env.put("java.naming.ldap.version", "3"); > env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system"); > env.put(Context.SECURITY_CREDENTIALS, "secret"); > int positive = 0; > > for (int i = 0; i < 1000; i++) > { > // Try to authenticate user. > DirContext userContext = new InitialDirContext(env); > > final SearchControls constraints = new SearchControls(); > constraints.setDerefLinkFlag(true); > constraints.setSearchScope(SearchControls.SUBTREE_SCOPE); > String filter = > "(&(cn=administrators)(uniqueMember=uid=akarasulu,ou=users,ou=system))"; > NamingEnumeration enum = > userContext.search("ou=groups,ou=system", filter, constraints); > enum = userContext.search("ou=groups,ou=system", filter, > constraints); > > if (enum.hasMoreElements()) positive++; > userContext.close(); > } > System.out.println(positive); > > } > ============= SERVER STARTUP CODE > // Start the LDAP server > Properties env = new Properties(); > env.setProperty(Context.PROVIDER_URL, "ou=system"); > env.setProperty(Context.INITIAL_CONTEXT_FACTORY, > "org.apache.ldap.server.jndi.ServerContextFactory"); > try > { > new InitialDirContext(env); > } > catch (NamingException e) > { > e.printStackTrace(); > } > ============= CLIENT STACK TRACE > javax.naming.CommunicationException: Request: 1 cancelled > at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60) > at com.sun.jndi.ldap.Connection.readReply(Connection.java:405) > at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:340) > at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:193) > at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2640) > at com.sun.jndi.ldap.LdapCtx.(LdapCtx.java:290) > at > com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175) > at > com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193) > at > com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136) > at > com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66) > at > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) > at > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243) > at javax.naming.InitialContext.init(InitialContext.java:219) > at javax.naming.InitialContext.(InitialContext.java:195) > at > javax.naming.directory.InitialDirContext.(InitialDirContext.java:80) > at id.security.authentication.service.ldap.Test.main(Test.java:34) > ============= SERVER STACK TRACE > java.lang.NullPointerException > at > sun.nio.ch.WindowsSelectorImpl$SubSelector.processFDSet(WindowsSelectorImpl.java:321) > at > sun.nio.ch.WindowsSelectorImpl$SubSelector.processSelectedKeys(WindowsSelectorImpl.java:290) > at > sun.nio.ch.WindowsSelectorImpl$SubSelector.access$2800(WindowsSelectorImpl.java:253) > at > sun.nio.ch.WindowsSelectorImpl.updateSelectedKeys(WindowsSelectorImpl.java:439) > at > sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:145) > at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:59) > at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:70) > at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:74) > at > org.apache.apseda.input.TCPInputManager.run(TCPInputManager.java:158) > at java.lang.Thread.run(Thread.java:534) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.