haresh14 / vt-middleware

Automatically exported from code.google.com/p/vt-middleware
0 stars 0 forks source link

ldaptive: RecursiveEntryHandler concurrent modification #193

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

The following block of code will throw a WARN level unexpected exception:

final RecursiveEntryHandler recursiveEntryHandler =
      new RecursiveEntryHandler(
      "groupMembership",
      new String[]{"groupMembership"});

searchRequest = new SearchRequest(
      "ou=Groups,dc=organization,dc=org",
      searchFilter, "groupMembership");

searchRequest.setSearchEntryHandlers(recursiveEntryHandler);

final SearchResult result = search.execute(searchRequest).getResult();

What is the expected output? What do you see instead?

Expected output is the result object with no warnings or errors.
What's observed instead is:

[pool-3-thread-1] WARN org.ldaptive.SearchOperation - 
org.ldaptive.handler.RecursiveEntryHandler@697f41f1 threw unexpected exception
java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:894)
    at java.util.HashMap$KeyIterator.next(HashMap.java:928)
    at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1067)
    at org.ldaptive.handler.RecursiveEntryHandler.readSearchAttribute(RecursiveEntryHandler.java:198)
    at org.ldaptive.handler.RecursiveEntryHandler.handle(RecursiveEntryHandler.java:171)
    at org.ldaptive.handler.RecursiveEntryHandler.handle(RecursiveEntryHandler.java:61)
    at org.ldaptive.AbstractOperation.executeHandlers(AbstractOperation.java:203)
    at org.ldaptive.SearchOperation.readResult(SearchOperation.java:159)
    at org.ldaptive.SearchOperation.executeSearch(SearchOperation.java:121)
    at org.ldaptive.SearchOperation.invoke(SearchOperation.java:101)
    at org.ldaptive.SearchOperation.invoke(SearchOperation.java:28)
    at org.ldaptive.AbstractOperation.execute(AbstractOperation.java:142)

What version of the product are you using? On what operating system?

ldaptive.version=ldaptive 1.0.1
java.runtime.version=1.7.0_25-b15
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
os.name=Linux

Please provide any additional information below.

It's basically a concurrent modification exception.  I'm attaching the 
modifications I've made to fix it.

Original issue reported on code.google.com by ememi...@gmail.com on 24 Oct 2013 at 3:39

Attachments:

GoogleCodeExporter commented 9 years ago
I'm having some trouble reproducing this.
In your sample code, what value do you use for searchFilter?

Original comment by dfis...@gmail.com on 24 Oct 2013 at 8:57

GoogleCodeExporter commented 9 years ago
Please provide a sample LDIF as well.

Original comment by dfis...@gmail.com on 24 Oct 2013 at 9:42

GoogleCodeExporter commented 9 years ago
Nevermind, I found a dataset that reproduces this.

Original comment by dfis...@gmail.com on 25 Oct 2013 at 1:58

GoogleCodeExporter commented 9 years ago
Rather than passing an index around, I'm considering using a 
CopyOnWriteArrayList.
Thoughts?

Original comment by dfis...@gmail.com on 25 Oct 2013 at 2:50

GoogleCodeExporter commented 9 years ago
I decided to just copy the values once at the outset.
See r2824.

Original comment by dfis...@gmail.com on 25 Oct 2013 at 6:15

GoogleCodeExporter commented 9 years ago
Please confirm the latest snapshot fixes your issue.

Original comment by dfis...@gmail.com on 29 Oct 2013 at 7:46

GoogleCodeExporter commented 9 years ago
Issue is gone.  Confirmed.

Original comment by ememi...@gmail.com on 30 Oct 2013 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by dfis...@gmail.com on 30 Oct 2013 at 3:29