Failed to finalize task

I have the same error this is the compute engine logs

2020.04.21 10:28:05 ERROR ce[AXGb2TumVm04a7-8faQz][o.s.c.t.CeWorkerImpl] Failed to finalize task with uuid 'AXGb2TumVm04a7-8faQz' and persist its state to db
java.lang.IllegalStateException: Task does not exist anymore: CeTask{organizationUuid=AWkv_fdNs5cDpYntB8Oq, type=REPORT, uuid=AXGb2TumVm04a7-8faQz, component=Component{uuid='AW3-Ao6U3lZs7YVNM03x', key='*******', name='******'}, mainComponent=Component{uuid='AW3-Ao6U3lZs7YVNM03x', key='********', name='******'}, submitter=User{uuid='******', login='********'}}
	at org.sonar.ce.queue.InternalCeQueueImpl.lambda$remove$0(InternalCeQueueImpl.java:118)
	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
	at org.sonar.ce.queue.InternalCeQueueImpl.remove(InternalCeQueueImpl.java:118)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.finalizeTask(CeWorkerImpl.java:242)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.afterExecute(CeWorkerImpl.java:236)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.close(CeWorkerImpl.java:196)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:159)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:133)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:85)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Hi,

You haven’t given us much here. How about some context?

 
Ann

I may be able to give some context to a similar message I have in my logs.

2020.06.10 13:05:10 TRACE ce[sql] time=0ms | sql=select cq.uuid, cq.task_type as taskType, cq.component_uuid as componentUuid, cq.main_component_uuid as mainComponentUuid, cq.status as status, cq.submitter_uuid as submitterUuid, cq.worker_uuid as workerUuid, cq.started_at as startedAt, cq.created_at as createdAt, cq.updated_at as updatedAt from ce_queue cq where cq.status = ‘PENDING’ and cq.started_at is not null
**
2020.06.10 13:06:13 ERROR ce[AXKfMQ7tAPMkJXsnYaNK][o.s.c.t.CeWorkerImpl] Failed to finalize task with uuid ‘AXKfMQ7tAPMkJXsnYaNK’ and persist its state to db
IllegalStateException stacktrace
2020.06.10 13:06:13 INFO ce[AXKfMQ7tAPMkJXsnYaNK][o.s.c.t.CeWorkerImpl] Executed task | project=*** | type=REPORT | branch=*** | branchType=BRANCH | id=AXKfMQ7tAPMkJXsnYaNK | submitter=*** | status=SUCCESS | time=80568ms

This happens on a 8.3.1.34397 install that started with a blank MSSQL server.

I am not sure where to go after this other than to move the SQL server to a different product/location

Also the measures tab for any scans that “partially” complete will display “The request cannot be processed. Try again later.” when trying to activate the measure tab.

@Tarig0, is there anything else in your logs?

Regarding the UI, what do you see in your browser console? I guess a 500 error? If so, that would be worth checking web.log for.

 
Ann

I think I was getting the “request cannot be processed” message was because even though the status is canceled for the background task its still running the CE so the metrics were still being processed… After a few more minutes I was able to pull the metrics.

I would like to concentrate on why the CE background tasks are being lost in the queue while being processed though. I’m not seeing them being deleted anywhere in the CE log.

In the related thread that this one was split from, it was a problem with too little filespace available to the DB. We’ve also seen a problem when the CI deletes the branch in SonarQube while an analysis is being processed for it. Does either of these sound right?

 
Ann

Branch is a long living branch so that doesn’t make sense. No indicators of memory issues on the mssql server.

@Ahmed_Ghanmi I found out my issue was multiple sonarqube front end servers using the same sql server. You can check this by changing your connection string to use a new database catalog/instance and see if that resolves the error.