Uploaded image for project: 'Nuxeo Java Client'
  1. Nuxeo Java Client
  2. JAVACLIENT-224

Fix ConcurrentModificationException on sub-object creation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.12.0
    • Component/s: Core

      Description

      We saw on production the error below:

      Caused by: java.util.ConcurrentModificationException
      	at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1493)
      	at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1526)
      	at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1524)
      	at java.base/java.util.HashMap.putMapEntries(HashMap.java:507)
      	at java.base/java.util.HashMap.putAll(HashMap.java:780)
      	at org.nuxeo.client.objects.AbstractBase.replaceWith(AbstractBase.java:322)
      	at org.nuxeo.client.objects.AbstractBase.<init>(AbstractBase.java:73)
      	at org.nuxeo.client.objects.AbstractConnectable.<init>(AbstractConnectable.java:58)
      	at org.nuxeo.client.objects.ConnectableEntity.<init>(ConnectableEntity.java:49)
      	at org.nuxeo.client.objects.RepositoryEntity.<init>(RepositoryEntity.java:40)
      	at org.nuxeo.client.objects.Repository.<init>(Repository.java:44)
      	at org.nuxeo.client.objects.Repository.<init>(Repository.java:48)
      	at org.nuxeo.client.NuxeoClient.repository(NuxeoClient.java:201)
      

      This seems to happen when the client is used in a concurrent environment and two threads are trying to create a sub-object of the client, such as repository, directory, header, and more globally every method which touch the headerInterceptors and headerValues maps.

      We should add a synchronized bloc to avoid this error.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kleturc Kevin Leturc
                Reporter:
                kleturc Kevin Leturc
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: