Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-11964

JSM fails to fully start due to the presence of an issue SLA with invalid start/stop time

    XMLWordPrintable

Details

    Description

      Issue Summary

      When starting JSM (Jira Service Management), the customer portal and other JSM functionality briefly load, then go unavailable again, showing the following "403" error in the UI:

      Encountered a "403 - Forbidden" error while loading this page. JIRA Service Desk is not licensed
      

      Additionally, trying to access any JSM specific configuration in JSM Projects (such as Project Settings > SLAs, Project Settings > Customer Permissions, etc...) the page is blank and the error "Snap! You can't view this page" is thrown in the browser console tab:

      This is due to a timed promise in the WAITING_ON_TASKS state attempting to calculate an associated issue's SLA that has an invalid start/stop time

      This issue is fixed in JSM version 4.19.0 and above.

      [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] com.atlassian.servicedesk.internal.sla.metric.DateTimeRange - the START time of the DateTimeRange (2022-08-09T05:35:35.273Z) must be less than or equal to the STOP time (2022-08-09T05:34:03.397Z)
      

      and

      [atlassian.servicedesk.lifecycle] We are now in an indeterminable state. 

      Mode of failure

      1. During start up, JSM initialises the "Timed Promise" system so that SLA can be calculated as per normal functionality.
      2. As part of this check, the AO_F1B27B_PROMISE database table is looked up and any SLA entries that have the STATUS of WAITING_ON_TASKS are processed
      3. This promise is associated to a fixed set of issues. These can be found in the DB by matching the row in the "AO_F1B27B_PROMISE" table's ID column to the "AO_F1B27B_KEY_COMPONENT" table's "TIMED_PROMISE_ID" column. The issue key will be listed with KEY='issue.id' and VALUE to be the id of the issue within the jiraissue table
      4. If an issue in that table has a SLA that is to be calculated, AND, that SLA has at least one completed SLA cycle in the SLA's database custom field value, AND, has higher startDateTime compared to stopDateTime, then the SLA calculation will fail and prevents start up

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      1. Create a test issue and test SLA
      2. Ensure the issue meets the requirement above. You may shut down the database and modify rows appropriately
      3. Start Jira

      Expected Results

      Jira startup is not blocked

      Actual Results

      JSM plugin loads briefly, then shuts down again. The following lines are logged in the application log (atlassian-jira.log)

      2022-09-07 10:31:08,543-0700 https-jsse-nio-8082-exec-12 url: /rest/plugins/applications/1.0/installed/jira-servicedesk/license; user: whispy INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.jira.application.ApplicationConfigurationHelper] Application already configured for jira-servicedesk.
      2022-09-07 10:31:08,604-0700 audit-broker-consumer-thread-1733472908 DEBUG      [c.a.activeobjects.osgi.ActiveObjectsServiceFactory] getService bundle [com.atlassian.audit.atlassian-audit-plugin]
      2022-09-07 10:31:08,615-0700 https-jsse-nio-8082-exec-12 url: /rest/plugins/applications/1.0/installed/jira-servicedesk/license; user: whispy WARN whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] A LicenseChangedEvent event has occurred.  Reacting asynchronously to this...
      2022-09-07 10:31:08,620-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] Restarting Service Desk plugin...
      2022-09-07 10:31:08,622-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] Server Plugin LifeCycle - Stopping Service Desk
      2022-09-07 10:31:08,651-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] Not disabling ServiceDesk mail channels... there are 2 other nodes that are still live
      2022-09-07 10:31:08,655-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] Unregister job runner to periodically ensure SD mail channels are enabled
      2022-09-07 10:31:08,656-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] Finished unregistering job runner  to periodically ensure SD mail channels are enabled
      2022-09-07 10:31:08,665-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] Successfully unscheduled jobId=sd.async.upgrade.tasks.job.runner
      2022-09-07 10:31:08,665-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] Unregistering Service Desk async job runner
      2022-09-07 10:31:08,665-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] Unregistered Service Desk async job runner successfully
      2022-09-07 10:31:08,665-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] stopped
      2022-09-07 10:31:08,665-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] Server Plugin LifeCycle - Starting Service Desk
      2022-09-07 10:31:08,665-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] Checking license...
      2022-09-07 10:31:08,665-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] Check if upgrade requirements are satisfied...
      2022-09-07 10:31:08,666-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] Initialising ActiveObjects support and running AO upgrade tasks...
      2022-09-07 10:31:09,182-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] Startup has failed with an unexpected problem. It is unsafe to proceed.
      2022-09-07 10:31:09,182-0700 JIRA-EventThread-15 ERROR whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [c.a.s.b.lifecycle.server.ServerPluginLifeCycle] com.atlassian.servicedesk.internal.sla.metric.DateTimeRange - the START time of the DateTimeRange (2022-08-09T05:35:35.273Z) must be less than or equal to the STOP time (2022-08-09T05:34:03.397Z)
      com.atlassian.servicedesk.internal.sla.metric.DateTimeRangeException: com.atlassian.servicedesk.internal.sla.metric.DateTimeRange - the START time of the DateTimeRange (2022-08-09T05:35:35.273Z) must be less than or equal to the STOP time (2022-08-09T05:34:03.397Z)
      	...
      2022-09-07 10:31:09,184-0700 JIRA-EventThread-15 INFO whispy 631x396x2 1vxd0ky 127.0.0.1 /rest/plugins/applications/1.0/installed/jira-servicedesk/license [atlassian.servicedesk.lifecycle] We are now in an indeterminable state.
      

      Workaround

      Atlassian has developed a plugin called Bytecat that allows modification of Java code within Jira itself. The plugin is loaded like any other Atlassian plugin - via UPM. The rule below will bypass the date comparison and expect to resolve the startup problem:

      1. Install the Bytecat plugin to Jira -  atlassian-bytecat-plugin-0.1.0-SNAPSHOT.obr
      2. Browse to the Instrumentation (Bytecat) Jira Admin page
      3. Click the "Activate" button to activate the system
      4. Click Add Rule and add the following contents, but leave the rule disabled
        RULE | SLA Start Stop Killer | - OUT
        CLASS com.atlassian.servicedesk.internal.sla.metric.DateTimeRange
        METHOD <init>
        AT ENTRY
        IF $1.compareTo($2) > 0
        DO $1 = $2
        ENDRULE
        

      If the problem occurs, visit the Bytecat admin page, and toggle ON the rule. Once Jira is started up successfully, toggle OFF the rule.

      Theory of operation

      • ByteCat runs in the background when the rule is enabled and watches for invocations of the constructor of the START/STOP comparison class, DateTimeRange
      • When it is invoked, it checks if parameter 1 (start time) is higher than parameter 2 (stop time). If so, then it sets Start time to equal Stop time
      • This will ensure that the exception is not thrown, and thus, plugin startup is expected to not be interrupted

      Impact

      • ByteCat uses a low-level bytecode replacement technique to apply changes. We don't anticipate performance issue
      • ByteCat is however designed for temporary use only. We don't recommend leaving it on all the time

      Attachments

        Issue Links

          Activity

            People

              esantos2 Elton Santos
              allewellyn@atlassian.com Alex [Atlassian,PSE]
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Backbone Issue Sync