directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <elecha...@gmail.com>
Subject Strange (and rare) errors while doing searches
Date Mon, 30 Apr 2012 00:15:01 GMT
Hi guys,

I'm facing some serious issue, and I have not a clue about its reason.

When I do a performance test on a subtree search, I do sometime get an 
exception, which stack trace is :

org.apache.directory.shared.ldap.model.exception.LdapOperationErrorException
     at 
org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.lookup(AbstractBTreePartition.java:1098)
     at 
org.apache.directory.server.xdbm.search.impl.PresenceEvaluator.evaluate(PresenceEvaluator.java:105)
     at 
org.apache.directory.server.xdbm.search.impl.PresenceCursor.next(PresenceCursor.java:265)
     at 
org.apache.directory.server.xdbm.search.impl.AndCursor.next(AndCursor.java:154)
     at 
org.apache.directory.server.core.partition.impl.btree.EntryCursorAdaptor.next(EntryCursorAdaptor.java:177)
     at 
org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor.next(BaseEntryFilteringCursor.java:472)
     at 
org.apache.directory.server.core.api.EntryToResponseCursor.next(EntryToResponseCursor.java:166)
     at 
org.apache.directory.ldap.client.api.EntryCursorImpl.next(EntryCursorImpl.java:78)
     at 
org.apache.directory.server.core.operations.search.SearchPerfIT.testSearchPerfSublevelScope(SearchPerfIT.java:248)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
     at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
     at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
     at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
     at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
     at 
org.apache.directory.server.core.integ.FrameworkRunner.runChild(FrameworkRunner.java:488)
     at 
org.apache.directory.server.core.integ.FrameworkRunner.runChild(FrameworkRunner.java:58)
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
     at 
org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:256)
     at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
     at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.util.ConcurrentModificationException
     at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
     at java.util.HashMap$ValueIterator.next(HashMap.java:822)
     at 
org.apache.directory.shared.ldap.model.entry.DefaultEntry.clone(DefaultEntry.java:1014)
     at 
org.apache.directory.server.core.api.entry.ClonedServerEntry.<init>(ClonedServerEntry.java:75)
     at 
org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.lookup(AbstractBTreePartition.java:1091)
     ... 33 more

This is more than strange, because this exception occurs whil I try to 
clone an Entry. The associated code is :
     public Entry clone()
     {
         try
         {
             // First, clone the structure
             DefaultEntry clone = ( DefaultEntry ) super.clone();

             // Just in case ... Should *never* happen
             if ( clone == null )
             {
                 return null;
             }

             // An Entry has a Dn and many attributes.
             clone.dn = dn; // note that Dn is immutable now

             // then clone the ClientAttribute Map.
             clone.attributes = ( Map<String, Attribute> ) ( ( ( 
HashMap<String, Attribute> ) attributes )
                 .clone() );

             // now clone all the attributes
             clone.attributes.clear();

             if ( schemaManager != null )
             {
                 for ( Attribute attribute : attributes.values() ) 
<<----- Exception here !
                 {
                 ...

The Entry is not supposed to be modified during this test, so I don't 
see how possibly we can get a ConcurrentModificationException at this 
point...

One of the solution would be to make the entry an immutable element, but 
it might be a costly operation, assuming we never modify an entry on the 
fly...

Any help or suggestion welcomed !

-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.iktek.com


Mime
View raw message