Uploaded image for project: 'Bitbucket Server'
  1. Bitbucket Server
  2. BSERV-13014

CachingRepositoryHookScmHelper.getCache() fails with ConcurrentModificationException

    XMLWordPrintable

Details

    Description

      Issue Summary

      When running with a Java 11 JRE CachingRepositoryHookScmHelper.getCache() can fail with a ConcurrentModificationException. This happens because a HashMap is used and doesn't provide the concurrency support needed. The behaviour changed in Java 9+ when the fix for https://bugs.openjdk.java.net/browse/JDK-80716 was implemented. The change involved adding some extra checks to determine if the mapping function modifies this map during computation, but also picks up the concurrent modification that happens in CachingRepositoryHookScmHelper. (See http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/0c3aa853064e)

      The below exception is thrown and logged in the atlassian-bitbucket.log file:

      Caused by: java.util.ConcurrentModificationException: null
      	at java.base/java.util.HashMap.computeIfAbsent(Unknown Source)
      	at com.atlassian.stash.internal.hook.repository.CachingRepositoryHookScmHelper.getCache(CachingRepositoryHookScmHelper.java:216)
      	at com.atlassian.stash.internal.hook.repository.CachingRepositoryHookScmHelper.getCache(CachingRepositoryHookScmHelper.java:211)
      	at com.atlassian.stash.internal.hook.repository.CachingRepositoryHookScmHelper.resolveCommitIds(CachingRepositoryHookScmHelper.java:109)
      

      Workaround

      Run Bitbucket Server with a Java 8 JRE

      Attachments

        Issue Links

          Activity

            People

              behumphreys Ben Humphreys
              behumphreys Ben Humphreys
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: