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

Restarting CE project analysis task after restart of SQ fails with SQL error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.1
    • Fix Version/s: 6.2
    • Component/s: Compute Engine
    • Labels:

      Description

      Some tasks fail with the following error:

      java.lang.IllegalStateException: Fail to insert scanner context for task AVfXSZmBw72xhIYRytsz
      	at org.sonar.db.ce.CeScannerContextDao.insert(CeScannerContextDao.java:67)
      	at org.sonar.server.computation.task.projectanalysis.step.PersistScannerContextStep.execute(PersistScannerContextStep.java:50)
      	at org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64)
      	at org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52)
      	at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
      	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:84)
      	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:57)
      	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35)
      	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:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_ce_scanner_context"
        Detail: Key (task_uuid)=(AVfXSZmBw72xhIYRytsz) already exists.
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2310)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2023)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:217)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:421)
      	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:166)
      	at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:137)
      	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      	at org.sonar.db.ce.CeScannerContextDao.insert(CeScannerContextDao.java:64)
      	... 15 more
      

      Steps to reproduce:

      1. start processing a project analysis report with a scanner context
      2. stop/restart SonarQube after the scanner context has been persisted to DB and before the processing is done
      3. when SonarQube restarts, it reset the aborted task and start processing it again
      4. at the step persisting the scanner context, the error above appears

        Attachments

          Activity

            People

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

              Dates

              • Due:
                Created:
                Updated:
                Resolved: