The error "Cannot start a job instance that already exists..." occurs when duplicate indexing tasks are created and duplicate entries are displayed


The Indexer job on the SAS Visual Investigator - Admin Jobs tab displays double the number of entries in the task, causing the Indexing job to get stuck.

Here is an example scenario. You typically index 183 total items nightly. Intermittently, double the number of entries is displayed (that is, 366 total entries) on the Jobs tab.

In the duplicate data objects scenario, the incremental indexing is suspended with X/366.

As a result, the following occurs:

This issue occurs because, in RabbitMQ, the consumer can time-out when it is processing before the RabbitMQ message is acknowledged. If the message broker goes down, when the queue comes back up, the message attempts to redeliver.  

As a result, the following error occurs in the svi-indexer logs:

...

com.sas.fcs.datahub.DataHubException: The job with ID "indexerJob" failed to start.
    at com.sas.svi.indexer.scalable.ScalableSearchIndexLoaderJob.start
(ScalableSearchIndexLoaderJob.java:38)
    at com.sas.svi.indexer.datahub.services.data.loader.jobs.AsyncJobStarter.
startJob_aroundBody0(AsyncJobStarter.java:32)
Caused by: org.springframework.batch.core.launch.JobInstanceAlreadyExistsException: Cannot start a job instance that already exists with name=indexerJob and parameters=jobId=586a8ecc-2cc7-4a39-a66c-97c689ed6814, tenant=__default__, reindexJobType=REINDEX_ONE, reindexAllSystemLinks=false, reindexAllSystemTransactions=false, operation=LOAD
    at org.springframework.batch.core.launch.support.SimpleJobOperator.start
(SimpleJobOperator.java:309)
    at org.springframework.batch.core.launch.support.SimpleJobOperator$$
FastClassBySpringCGLIB$$44ee6049.invoke(<generated>)

...