CachingRepositoryHookScmHelper.getCache() fails with ConcurrentModificationException

XMLWordPrintable

    • 1
    • Severity 3 - Minor
    • 3

      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

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

                Created:
                Updated:
                Resolved: