CANONICALISING_REGEX used for specs processing is inefficient

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      Issue Summary

      Specs processing takes a longer time than expected and observe that "specsdetectionthreads" running longer at below:

      com.atlassian.bamboo.specs.util.YamlFile.toCanonicalContent(YamlFile.java:84)
      com.atlassian.bamboo.specs.util.YamlFile.getCanonicalContentHash(YamlFile.java:80)
      com.atlassian.bamboo.specs.util.YamlFile.generateFileName(YamlFile.java:76)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.dumpToYmlFile(YamlSpecsImportServiceImpl.java:90)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.lambda$generateInternalYamls$6(YamlSpecsImportServiceImpl.java:241)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl$$Lambda$4110/0x00007f1398a4d8b0.accept(Unknown Source)
      

      Steps to Reproduce

      N/A

      Expected Results

      This Regex handling should be more efficient

      Actual Results

      Full stack trace from thread dumps:

      java.lang.Character.codePointBefore(java.base@11.0.21/Character.java:8369)
      java.util.regex.Pattern$CharPropertyGreedy.match(java.base@11.0.21/Pattern.java:4314)
      java.util.regex.Pattern$Start.match(java.base@11.0.21/Pattern.java:3622)
      java.util.regex.Matcher.search(java.base@11.0.21/Matcher.java:1729)
      java.util.regex.Matcher.find(java.base@11.0.21/Matcher.java:746)
      java.util.regex.Matcher.replaceAll(java.base@11.0.21/Matcher.java:1178)
      com.atlassian.bamboo.specs.util.YamlFile.toCanonicalContent(YamlFile.java:84)
      com.atlassian.bamboo.specs.util.YamlFile.getCanonicalContentHash(YamlFile.java:80)
      com.atlassian.bamboo.specs.util.YamlFile.generateFileName(YamlFile.java:76)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.dumpToYmlFile(YamlSpecsImportServiceImpl.java:90)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.lambda$generateInternalYamls$6(YamlSpecsImportServiceImpl.java:241)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl$$Lambda$4110/0x00007f1398a4d8b0.accept(Unknown Source)
      java.util.ArrayList.forEach(java.base@11.0.21/ArrayList.java:1541)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.generateInternalYamls(YamlSpecsImportServiceImpl.java:241)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.lambda$processSimplifiedYaml$0(YamlSpecsImportServiceImpl.java:109)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl$$Lambda$4103/0x00007f1398a410b0.accept(Unknown Source)
      com.atlassian.bamboo.configuration.external.rss.SpecsOptimizeProcessor.processSpecs(SpecsOptimizeProcessor.java:37)
      com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.processSimplifiedYaml(YamlSpecsImportServiceImpl.java:108)
      com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.tryProcessYaml(RepositoryStoredSpecsServiceImpl.java:341)
      com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.runBambooSpecs(RepositoryStoredSpecsServiceImpl.java:184)
      com.atlassian.bamboo.configuration.external.RssDetectionServiceImpl.runRssDetection(RssDetectionServiceImpl.java:374)
      com.atlassian.bamboo.configuration.external.detection.RssDetectionRunnable.run(RssDetectionRunnable.java:42)
      java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.21/Executors.java:515)
      java.util.concurrent.FutureTask.run(java.base@11.0.21/FutureTask.java:264)
      java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.21/ThreadPoolExecutor.java:1128)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.21/ThreadPoolExecutor.java:628)
      com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
      com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
      com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
      com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
      java.lang.Thread.run(java.base@11.0.21/Thread.java:829)
      

      Attached is the screenshot

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

            Assignee:
            Marcin Gardias
            Reporter:
            Jyothi Charupalli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: