Uploaded image for project: 'Periscope'
  1. Periscope
  2. MGNLPER-130

ConcurrentModificationException after login (probl. obsolete?)

XMLWordPrintable

      Steps to reproduce

      Login and out a couple (of dozen) times alternating between the users eric, peter and tina. Eventually ConcurrentModificationException will be logged:

      2020-03-19 10:56:48,989 ERROR gnolia.admincentral.findbar.search.ResultCollector: An error occurred during the search process, therefore an empty collection will be returned.
      java.util.concurrent.CompletionException: java.lang.RuntimeException: java.util.ConcurrentModificationException
      	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273) ~[?:1.8.0_222]
      	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280) ~[?:1.8.0_222]
      	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1592) ~[?:1.8.0_222]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_222]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_222]
      	at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_222]
      Caused by: java.lang.RuntimeException: java.util.ConcurrentModificationException
      	at info.magnolia.periscope.Periscope.lambda$search$1(Periscope.java:125) ~[magnolia-periscope-core-1.2-SNAPSHOT.jar:?]
      	at info.magnolia.periscope.search.SearchRunner.lambda$execute$0(SearchRunner.java:85) ~[magnolia-periscope-core-1.2-SNAPSHOT.jar:?]
      	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) ~[?:1.8.0_222]
      	... 3 more
      Caused by: java.util.ConcurrentModificationException
      	at org.apache.commons.collections4.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:574) ~[commons-collections4-4.4.jar:4.4]
      	at org.apache.commons.collections4.map.AbstractLinkedMap$KeySetIterator.next(AbstractLinkedMap.java:469) ~[commons-collections4-4.4.jar:4.4]
      	at java.util.AbstractCollection.toArray(AbstractCollection.java:141) ~[?:1.8.0_222]
      	at java.util.ArrayList.<init>(ArrayList.java:178) ~[?:1.8.0_222]
      	at info.magnolia.periscope.rank.ml.IndexedBuffer.asList(IndexedBuffer.java:97) ~[magnolia-periscope-result-ranker-1.2-SNAPSHOT.jar:?]
      	at info.magnolia.periscope.rank.ml.NeuralNetworkResultRanker.outputArrayToResults(NeuralNetworkResultRanker.java:193) ~[magnolia-periscope-result-ranker-1.2-SNAPSHOT.jar:?]
      	at info.magnolia.periscope.rank.ml.NeuralNetworkResultRanker.rank(NeuralNetworkResultRanker.java:143) ~[magnolia-periscope-result-ranker-1.2-SNAPSHOT.jar:?]
      	at info.magnolia.periscope.Periscope.fetchSupplierAwareSearchResults(Periscope.java:143) ~[magnolia-periscope-core-1.2-SNAPSHOT.jar:?]
      	at info.magnolia.periscope.Periscope.lambda$null$0(Periscope.java:123) ~[magnolia-periscope-core-1.2-SNAPSHOT.jar:?]
      	at info.magnolia.context.AsynchronousContext$OperationFactory.lambda$wrap$0(AsynchronousContext.java:122) ~[magnolia-core-6.2-SNAPSHOT.jar:?]
      	at info.magnolia.periscope.Periscope.lambda$search$1(Periscope.java:123) ~[magnolia-periscope-core-1.2-SNAPSHOT.jar:?]
      	at info.magnolia.periscope.search.SearchRunner.lambda$execute$0(SearchRunner.java:85) ~[magnolia-periscope-core-1.2-SNAPSHOT.jar:?]
      	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) ~[?:1.8.0_222]
      	... 3 more 

      Initial analysis

      Looks like this is a regression introduced with MGNLPER-121.
      Namely the result ranker cache introduced there causes NeuralNetworkResultRanker instances to be shared between multiple threads. This in turn causes concurrent calls to mutators of IndexedBuffer , which uses the not thread safe LRUMap .

       

        Acceptance criteria

              mduerig Michael Duerig
              mduerig Michael Duerig
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD