Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-10512

Cancelling a Compute Engine task should have no effect if task was started in the meantime

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.3
    • Component/s: Compute Engine
    • Labels:
    • Edition:

      Description

      The following error occurred on SonarCloud:

      2018.03.23 15:05:41 ERROR ce[AWJTIL-2V4Tcj4EG2n-h][o.s.c.t.CeWorkerImpl] Failed to finalize task with uuid 'AWJTIL-2V4Tcj4EG2n-h' and persist its state to db
      java.lang.IllegalStateException: Task does not exist anymore: CeTask{organizationUuid=AWG4QTWS1uc8gbLrNZN3, type=REPORT, uuid=AWJTIL-2V4Tcj4EG2n-h, componentUuid=AWG4o2SC1uc8gbLrNZ80, componentKey=org.eclipse.che:che-parent:master, componentName=Che Parent master, submitterLogin=riuvshin@github}
              at org.sonar.ce.queue.InternalCeQueueImpl.lambda$remove$0(InternalCeQueueImpl.java:104)
              at java.util.Optional.orElseThrow(Optional.java:290)
              at org.sonar.ce.queue.InternalCeQueueImpl.remove(InternalCeQueueImpl.java:104)
              at org.sonar.ce.taskprocessor.CeWorkerImpl.finalizeTask(CeWorkerImpl.java:165)
              at org.sonar.ce.taskprocessor.CeWorkerImpl.executeTask(CeWorkerImpl.java:148)
              at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:97)
              at org.sonar.ce.taskprocessor.CeWorkerImpl.withCustomizedThreadName(CeWorkerImpl.java:81)
              at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:73)
              at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:43)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      

      This specific task appears as cancelled in the UI.

      It is quite obvious that we are facing a concurrency issue between the request to cancel the task and the processing of this task.
      In this case, the task was cancelled as it was already started being processed and when finalizing the processing, the task couldn't be found in CE_QUEUE table and this caused the error.

      Atomicity and resilience of operations on table CE_QUEUE and CE_ACTIVITY should be improved.

        Attachments

          Activity

            People

            • Assignee:
              sebastien.lesaint Sebastien Lesaint
              Reporter:
              sebastien.lesaint Sebastien Lesaint
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: