As an JIRA Datacenter Administrator I want to delete stuck global tasks

XMLWordPrintable

    • 15
    • 7

      Problem Definition

      Currently when Jira Datacenter has lost global task (see related JRASERVER-47045, JRASERVER-66204), there is no way to remove this task. All nodes still thinks task is running, so this prevents corresponding operations to be done. 

      Suggested Solution

      Create a plugin and/or health-check which lists running cluster tasks, show possible stuck and allow to remove them.

      Workaround

      Workaround via ScriptRunner in Script Console, From JRASERVER-66204?focusedCommentId=2280767

      1. List all live tasks:
        import com.atlassian.jira.component.ComponentAccessor
        import com.atlassian.jira.task.TaskManagerImpl
         
        def TaskManager = ComponentAccessor.getComponent(TaskManagerImpl)
        def tasks = TaskManager.getLiveTasks()
         
        for(key in tasks){
            log.info 'Taskid: ' + key.getTaskId() + ' Description: ' + key.getDescription() + ' Start Time:' + key.getStartedTimestamp() + ' Username: ' + key.getUserName()
        }
        
      2. Find stuck job and copy <Taskid> number
      3. Kill such Taskid, replacing xxxxxxx with Taskid number
        import com.atlassian.jira.component.ComponentAccessor
        import com.atlassian.jira.task.TaskManagerImpl
         
        def TaskManager = ComponentAccessor.getComponent(TaskManagerImpl)
        TaskManager.removeTask(xxxxxxx)
        

            Assignee:
            Unassigned
            Reporter:
            Andriy Yakovlev [Atlassian]
            Votes:
            19 Vote for this issue
            Watchers:
            26 Start watching this issue

              Created:
              Updated:
              Resolved: