Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-55449

The task report macro can execute long running SQL queries and cause performance degradation

XMLWordPrintable

      Resolution requires the faster permissions service

      To resolve this issue you will need to enable the faster permissions service in your site.

      Summary

      The task report macro can execute long running SQL queries and take a lot of memory if the macro is added with the default parameters. It happens because the plugin loads all active tasks to memory.

      Example SQL query:

      select distinct t."GLOBAL_ID" , t."CONTENT_ID", case when cu.lower_display_name is null then 0 else 1 end CU_LOWER_DISPLAY_NAME,
      cu.lower_display_name, t."CREATE_DATE" 
      from "AO_BAF3AA_AOINLINE_TASK" t 
      join CONTENT c on t."CONTENT_ID" = c.CONTENTID 
      join SPACES s on c.SPACEID = s.SPACEID 
      left join user_mapping um on t."ASSIGNEE_USER_KEY" = um.user_key 
      left join cwd_user cu on um.lower_username = cu.lower_user_name
      WHERE s.SPACESTATUS <> 'ARCHIVED' AND c.CONTENT_STATUS <> 'deleted' AND
      t."TASK_STATUS" = 'UNCHECKED' ORDER BY CU_LOWER_DISPLAY_NAME DESC, cu.lower_display_name ASC, t."CREATE_DATE" DESC
      

      Cause

      Two issues:

      1. DB issue: we scan all records from AO_BAF3AA_AOINLINE_TASK (tasks), CONTENT, cwd_user, user_mapping tables, filter them and join them. It is an expensive operation.
      2. JVM issue: for example, if we have 100K active tasks, DB will return a dataset with 100K records. It requires allocating a lot of objects and will require a lot of GC work later.

      How to reproduce

      1. Have a lot of active tasks
      2. Create a page and add a task report macro with default parameters

      Workaround

      Workaround 1 Remove task reports with "show ALL tasks" settings.

      To find all pages that use this macro, follow these steps:

      1. Navigate to Confluence Administration > Macro Usage
      2. Under Confluence Inline Tasks, the macro tasks-report-macro will be listed, it will show how many pages the macro is on alongside
      3. Click tasks-report-macro to view a list of pages containing the macro

      Workaround 2 Disable the macro

      1. Navigate to Confluence Administration > Manage Add-ons
      2. Search for "task" with the All add-ons filter applied
      3. Under Confluence Inline Tasks expand the + 51 of 51 modules expander
      4. Find Task report (tasks-report) in the list, and click Disable

              glipatov George Lipatov
              jwyllys Justin W.
              Votes:
              12 Vote for this issue
              Watchers:
              36 Start watching this issue

                Created:
                Updated:
                Resolved: