Fail to execute es requestES refresh request on indices 'components'

We are experiencing recurring issues with SonarQube where an ElasticsearchException is thrown, specifically when executing ES refresh requests on indices ‘components’. Below is the detailed error log: Fail to execute es requestES refresh request on indices 'components'
        at org.sonar.server.component.index.ComponentIndexer.delete(
        at org.sonar.ce.task.projectanalysis.purge.IndexPurgeListener.onComponentsDisabling(
        at org.sonar.db.purge.PurgeDao.purgeDisabledComponents(
        at org.sonar.db.purge.PurgeDao.purge(
        at org.sonar.ce.task.projectanalysis.purge.ProjectCleaner.purge(
        at org.sonar.ce.task.projectanalysis.purge.PurgeDatastoresStep.execute(
        at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(
        at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(
        at org.sonar.ce.task.step.ComputationStepExecutor.execute(
        at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(
        at org.sonar.ce.taskprocessor.CeWorkerImpl$
        at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(
        at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(
        at java.base/java.util.concurrent.Executors$
        at java.base/
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.base/java.util.concurrent.ThreadPoolExecutor$
        at java.base/
Caused by: java.lang.RuntimeException: Request cannot be executed; I/O reactor status: STOPPED
        at org.elasticsearch.client.RestClient.extractAndWrapCause(
        at org.elasticsearch.client.RestClient.performRequest(
        at org.elasticsearch.client.RestClient.performRequest(
        at org.elasticsearch.client.RestHighLevelClient.performClientRequest(
        at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(
        at org.elasticsearch.client.RestHighLevelClient.performRequest(
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(
        at org.elasticsearch.client.IndicesClient.refresh(
        ... 27 common frames omitted
Caused by: java.lang.IllegalStateException: Request cannot be executed; I/O reactor status: STOPPED
        at org.apache.http.util.Asserts.check(
        at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.ensureRunning(
        at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(
        at org.elasticsearch.client.RestClient.performRequest(
        ... 35 common frames omitted
  • We are using Sonar version - Developer EditionVersion 9.9 (build 65466)
  • Sonar scanner version - SonarScanner
  • SonarQube deployed using zip.
  • We tried the following work arounds,
 Initially, we restarted the SonarQube server, which resolved the issue temporarily.

Upon encountering the issue again, we followed the steps in the SonarQube community thread ``:
Stopped the SonarQube server.
Cleared the $SONAR_HOME/data/es7 path.
Restarted the SonarQube server.
This resolved the issue temporarily once again.

After performing the restart, we noticed several .hprof files had been created, though it is unclear if they were generated as a result of our actions.

We need assistance in permanently resolving this issue. Please provide guidance or potential solutions to prevent this error from recurring.

Hey there.

Do you see any specific errors in the logs? Particularly es.log is going to be interesting if the issue is with Elasticsearch.

es.log (5.9 KB)
ce.log (6.2 KB)
I have attached both es.log and ce.log files.
There are no es.log found at the incident time.

It looks like you’re facing multiple errors. I suggest focusing on this one:

2024.07.05 13:22:27 ERROR ce[AZCB4Kksvq986wGbAhnv][o.s.c.t.CeWorkerImpl] Failed to execute task AZCB4Kksvq986wGbAhnv
java.lang.OutOfMemoryError: Java heap space

I suggest bumping up the maximum heap size of your Compute Engine. If you have a particularly large project, this can be necessary.

In your conf/ file, you can adjust sonar.ce.javaOpts. I suggest a value of 2GB, assuming you have sufficient memory on the server.

sonar.ce.javaOpts=-Xmx2G -Xms128m -XX:+HeapDumpOnOutOfMemoryError

You’ll need to reboot the service for the changes to take affect (./ restart)

Thank you so much for your assistance. The solution you provided is working and our issue is now resolved. I really appreciate your prompt and effective help.