NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      Summary

      There is a CPU spike that hangs when using the Attachments macro. This can be consistently replicated when there are 200+ attachments in a Confluence page. The issues seems to be the number of attachments since testing with 1 large file (e.g. 1 GB) rather than 200 medium-sized files does not cause the same issue.

      Steps to Reproduce

      1. Create 200+ test attachments. The following Linux script can be used to create 200 txt files from an exisitng Confluence log file
         for f in {0..200}
        do
            cat atlassian-confluence.log > "$f.txt"
        done	
      2. Log in to Confluence
      3. Create a test space and test page
      4. Drag and drop the 200 test files to the page
      5. Keep an eye on the CPU usage. The CPU should be stable at this point
      6. Edit the Confluence page and add the Attachments macro
      7. Save the page
      8. Notice the CPU will spike and hang
      9. Disable the 'Confluence Attachments Plugin' and notce the CPU goes down almost instantly

      Expected Results

      The CPU does not hang for long periods of time.

      Actual Results

      The CPU will spike and hang.

      Sometimes the following will be displayed in the atlassian-confleunce.log file

      ERROR [http-nio-8081-exec-1800] [content.render.xhtml.DefaultRenderer] render Rendering this content exceeded the timeout of 120 seconds.
      

      Thread Dump References Attachments Macro: com.atlassian.confluence.extra.attachments.AttachmentsMacro.execute

      "http-nio-8081-exec-1800" #301091 daemon prio=5 os_prio=0 tid=0x00007f4af0014000 nid=0x5d6a runnable [0x00007f4b8fc80000]
         java.lang.Thread.State: RUNNABLE
      	at org.apache.lucene.search.HitQueue.getSentinelObject(HitQueue.java:72)
      	at org.apache.lucene.search.HitQueue.getSentinelObject(HitQueue.java:22)
      	at org.apache.lucene.util.PriorityQueue.<init>(PriorityQueue.java:73)
      	at org.apache.lucene.search.HitQueue.<init>(HitQueue.java:64)
      	at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:275)
      	at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:37)
      	at org.apache.lucene.search.TopScoreDocCollector$InOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:42)
      	at org.apache.lucene.search.TopScoreDocCollector$InOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:40)
      	at org.apache.lucene.search.TopScoreDocCollector.create(TopScoreDocCollector.java:258)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:487)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:444)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:281)
      	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:269)
      	at com.atlassian.bonnie.search.LuceneSearcher$1.perform(LuceneSearcher.java:97)
      	at com.atlassian.bonnie.LuceneConnection.withSearch(LuceneConnection.java:342)
      	at com.atlassian.bonnie.search.LuceneSearcher.search(LuceneSearcher.java:93)
      	at com.arsenale.plugins.lockpoint.conditions.ConditionCanAccessGliffyLink.shouldDisplay(SourceFile:57)
      	at com.atlassian.plugin.web.conditions.AndCompositeCondition.shouldDisplay(AndCompositeCondition.java:14)
      	at com.atlassian.plugin.web.DefaultWebInterfaceManager.filterFragmentsByCondition(DefaultWebInterfaceManager.java:153)
      	at com.atlassian.plugin.web.DefaultWebInterfaceManager.getDisplayableItems(DefaultWebInterfaceManager.java:106)
      	at com.atlassian.confluence.plugin.descriptor.web.ConfluenceWebInterfaceManager.getDisplayableItems(ConfluenceWebInterfaceManager.java:88)
      	at sun.reflect.GeneratedMethodAccessor10446.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:385)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:374)
      	at com.atlassian.confluence.velocity.introspection.UnboxingMethod.invoke(UnboxingMethod.java:34)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
      	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:507)
      	at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
      	at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.directive.Foreach.performIteration(Foreach.java:393)
      	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:316)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      	at org.apache.velocity.runtime.directive.Parse.render(Parse.java:263)
      	at com.atlassian.confluence.setup.velocity.ProfilingParseDirective.render(ProfilingParseDirective.java:24)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      	at org.apache.velocity.Template.merge(Template.java:328)
      	at org.apache.velocity.Template.merge(Template.java:235)
      	at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:84)
      	at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:95)
      	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:73)
      	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate(VelocityUtils.java:44)
      	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate(VelocityUtils.java:32)
      	at com.atlassian.confluence.plugin.services.DefaultVelocityHelperService.getRenderedTemplate(DefaultVelocityHelperService.java:13)
      	at sun.reflect.GeneratedMethodAccessor1470.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:117)
      	at com.sun.proxy.$Proxy264.getRenderedTemplate(Unknown Source)
      	at sun.reflect.GeneratedMethodAccessor1470.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:130)
      	at com.sun.proxy.$Proxy264.getRenderedTemplate(Unknown Source)
      	at com.atlassian.confluence.extra.attachments.AttachmentsMacro.execute(AttachmentsMacro.java:287)
      	
      	.....
      
         Locked ownable synchronizers:
      	- <0x00007f52cf420eb8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

      Workaround

      Disable the Confluence Attachments Plugin macro and use an alternative attachment macro if available.

            [CONFSERVER-40113] Excessive CPU usage with the Attachments Macro

            Atlassian Update - September 2019

            Thank you for your interest in this ticket. The Confluence Server and Data Center team released a major upgrade to the editor in 6.14. Due to the age of this ticket and/or lack of updates, we suspect that this issue is no longer relevant or was resolved as a result of the upgrade and are now closing this ticket.

            If this issue is still a problem in your Confluence instance in version 6.15 or later, please tag me in your comment and we can reopen this ticket for review.

            You can read more about the editor upgrade in the 6.14 Release Notes.

            Thanks

            Makisa Appleton | Senior Product Manager, Confluence Server and Data Center

            Makisa Appleton added a comment - Atlassian Update - September 2019 Thank you for your interest in this ticket. The Confluence Server and Data Center team released a major upgrade to the editor in 6.14. Due to the age of this ticket and/or lack of updates, we suspect that this issue is no longer relevant or was resolved as a result of the upgrade and are now closing this ticket. If this issue is still a problem in your Confluence instance in version 6.15 or later, please tag me in your comment and we can reopen this ticket for review. You can read more about the editor upgrade in the 6.14 Release Notes . Thanks Makisa Appleton | Senior Product Manager, Confluence Server and Data Center

            Fixed with Arsenal Lockpoint 1.6.6
            We had the same issues on our instance.

            Marc-Philip Blath added a comment - Fixed with Arsenal Lockpoint 1.6.6 We had the same issues on our instance.

            Broadcom Support added a comment - - edited

            Issue was caused by Arsenale LockPoint version 1.6.5

            Workaround

            1. go to Toolgear->Add-ons
            2. click on Arsenale Lockpoint to expand
            3. click on "xxx of yyy modules enabled" to expand
            4. Disable the four following modules that contain the specified names in parentheses:
              • arsenaleeditingliffy-newwindow
              • arsenaleeditingliffy-samewindow
              • arsenaleeditingliffy-html5
              • arsenaleeditingliffy-html5-gliffy6plus

            Ken

            Broadcom Support added a comment - - edited Issue was caused by Arsenale LockPoint version 1.6.5 Workaround go to Toolgear->Add-ons click on Arsenale Lockpoint to expand click on "xxx of yyy modules enabled" to expand Disable the four following modules that contain the specified names in parentheses: arsenaleeditingliffy-newwindow arsenaleeditingliffy-samewindow arsenaleeditingliffy-html5 arsenaleeditingliffy-html5-gliffy6plus Ken

              Unassigned Unassigned
              ajean Andy J.
              Affected customers:
              5 This affects my team
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: