Uploaded image for project: 'Automation for Jira Server'
  1. Automation for Jira Server
  2. JIRAAUTOSERVER-538

Automation for Jira rule execution may still be reported as in progress by audit logs and performance insight despite not being running anymore

    • Severity 3 - Minor
    • 0

      Issue Summary

      There might be occurrences on a production environment that may forcefully terminate the execution of Automation rules, such as when the Jira process is forcefully terminated.

      Those rules execution may still be reported as in progress despite not being running anymore.
      This affects the audit logs and performance insight.

      Steps to Reproduce

      1. Install a vanilla instance of Jira Data Center and make sure Automation for Jira is on the latest version available.
        • This was validated on Jira Software DC 9.2.0 (Automation for Jira 8.0.4).
      2. Create a sample project.
      3. Create a global rule with the following:
        • Trigger: Issue created.
        • Action: Add comment.
      4. Create an issue and ensure the rule runs properly.
      5. Attach a debugger to the Jira process and create a break point in com.codebarrel.automation.rulecomponent.jira.action.comment.executeWithIssues.
        • This is to make the bug easily recreated, but may not be the only way to trigger it in a production environment.
      6. Create a new issue so the rule is executed with the break point enabled.
      7. Forcefully kill Jira's JVM process while the rule was in progress.
        • Note the in progress rows in AO_589059_AUDIT_ITEM and AO_589059_RULE_STAT database tables.
      8. Start Jira and let it run for some minutes/hours.
      9. Check the rule audit log and performance insight.

      Expected Results

      Automation for Jira should have a way to identify a rule reported as in progress isn't really running anymore and update it in the audit and insight related tables.
      The rule execution that was in progress while Jira went down has a status of failure or some errors.

      Actual Results

      The rule execution that was in progress while Jira went down is still reporting a status of in progress and will continue to be until the audit log expiration job runs and captures this entry (only when it expires by its timestamp).

      The specific rule execution will still be reported as in progress in the Automation Performance Insight tables and the execution will never appear in the Insight UI.

      Workaround

      You may determine an interval on which a rule should not be executing anymore. For this example we will set 2 hours as the limit, but that will certainly be different on your instance and should be determined by the Jira administrator.
      With that you can periodically run queries to update the status directly in some database tables.

      1. Identify affected entries related to the audit log.
        PostgreSQL
        select ai.*
        from "AO_589059_AUDIT_ITEM" ai
        where ai."CATEGORY" = 'IN_PROGRESS'
        and ai."CREATED" < NOW() - INTERVAL '2 hours'
        
        SQL Server
        SELECT *
        FROM [dbo].[AO_589059_AUDIT_ITEM]
        WHERE [CATEGORY] = 'IN_PROGRESS'
        AND [CREATED] < dateadd(hour, -2, getdate());
        
      2. Update rows in the audit log table.
        PostgreSQL
        update "AO_589059_AUDIT_ITEM"
        set "CATEGORY" = 'SOME_ERRORS'
        where "CATEGORY" = 'IN_PROGRESS'
        and "CREATED" < NOW() - INTERVAL '2 hours'
        
        SQL Server
        UPDATE [dbo].[AO_589059_AUDIT_ITEM]
        SET [CATEGORY] = 'SOME_ERRORS'
        WHERE [CATEGORY] = 'IN_PROGRESS'
        AND [CREATED] < dateadd(hour, -2, getdate());
        
      3. Identify affected entries related to performance insight.
        PostgreSQL
        ------- AO_589059_RULE_STAT
        select rs.*
        from "AO_589059_RULE_STAT" rs
        where rs."CATEGORY" = 'IN_PROGRESS'
        and rs."CREATED" < NOW() - INTERVAL '2 hours'
        
        SQL Server
        SELECT *
        FROM [dbo].[AO_589059_RULE_STAT]
        WHERE [CATEGORY] = 'IN_PROGRESS'
        AND [CREATED] < dateadd(hour, -2, getdate());
        
      4. Update rows in the performance insight table.
        PostgreSQL
        ------- AO_589059_RULE_STAT
        update "AO_589059_RULE_STAT"
        set "CATEGORY" = 'SOME_ERRORS'
        where "CATEGORY" = 'IN_PROGRESS'
        and "CREATED" < NOW() - INTERVAL '2 hours'
        
        SQL Server
        UPDATE [dbo].[AO_589059_RULE_STAT]
        SET [CATEGORY] = 'SOME_ERRORS'
        WHERE [CATEGORY] = 'IN_PROGRESS'
        AND [CREATED] < dateadd(hour, -2, getdate());
        

        1. screenshot-1.png
          screenshot-1.png
          332 kB
        2. screenshot-2.png
          screenshot-2.png
          473 kB
        3. screenshot-3.png
          screenshot-3.png
          483 kB
        4. screenshot-4.png
          screenshot-4.png
          386 kB
        5. screenshot-5.png
          screenshot-5.png
          423 kB

          Form Name

            [JIRAAUTOSERVER-538] Automation for Jira rule execution may still be reported as in progress by audit logs and performance insight despite not being running anymore

            Nikhil Patil made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Nikhil Patil made changes -
            Fix Version/s New: 10.2.0 [ 109702 ]
            Kalai made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 961662 ]
            Gopal S made changes -
            Status Original: In Progress [ 3 ] New: Waiting for Release [ 12075 ]
            Gopal S made changes -
            Last Update On New: 26/Sep/2024 [ 2024-09-26 ]
            Status Original: In Progress [ 3 ] New: In Progress [ 3 ]
            Nikhil Patil made changes -
            Status Original: Short Term Backlog [ 12074 ] New: In Progress [ 3 ]
            Gopal S made changes -
            Assignee Original: Daniel Ramotowski [ dramotowski ] New: Gopal S [ 5a49889c485d ]
            Julien Rey made changes -
            Link New: This issue is related to JIRAAUTOSERVER-1032 [ JIRAAUTOSERVER-1032 ]
            Marc Dacanay made changes -
            Labels Original: iq-a4j New: iq-a4j whl-fy25q1
            Marc Dacanay made changes -
            Status Original: Gathering Impact [ 12072 ] New: Short Term Backlog [ 12074 ]

              5a49889c485d Gopal S
              tmasutti Thiago Masutti
              Affected customers:
              1 This affects my team
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: