highmed / highmed-dsf

HiGHmed Data Sharing Framework funded by the German Federal Ministry of Education and Research (BMBF, grant ids: 01ZZ1802E and 01ZZ1802A)
Apache License 2.0
32 stars 20 forks source link

Unable to Instantiate Process After BPE Restart #269

Closed hhund closed 3 years ago

hhund commented 3 years ago

Effected Version: 0.5.1

After a restart of the BPE new internal versions of every process definition (key + version) are created, if multiple versions of the same process plugin are present (e.g. codex-process-data-transfer-0.4.0.jar and codex-process-data-transfer-0.4.1.jar). This leads to multiple instances being found in the BPE database when instantiating a process based using a FHIR Task resource.

ERROR Grizzly(1) - BaseLogger.logError(160) | ENGINE-16004 Exception while closing command context: Query return 2 results instead of max 1
    org.camunda.bpm.engine.ProcessEngineException: Query return 2 results instead of max 1
        at org.camunda.bpm.engine.impl.AbstractQuery.executeSingleResult(AbstractQuery.java:245) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.AbstractQuery.execute(AbstractQuery.java:195) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:72) ~[camunda-engine-spring-7.15.0.jar:7.15.0]
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.3.9.jar:5.3.9]
        at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:70) ~[camunda-engine-spring-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.AbstractQuery.executeResult(AbstractQuery.java:160) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.camunda.bpm.engine.impl.AbstractQuery.singleResult(AbstractQuery.java:136) ~[camunda-engine-7.15.0.jar:7.15.0]
        at org.highmed.dsf.fhir.task.TaskHandler.getProcessDefinition(TaskHandler.java:193) ~[dsf-bpe-server-0.5.1.jar:0.5.1]

        ...

Workaround: If a restart of the BPE is needed, make sure to delete the BPE Database.

  1. stop BPE containers
    cd /opt/bpe/
    docker-compose down
  2. delete BPE database
    cd /opt/bpe/postgres-data
    sudo rm -r *
  3. start BPE containers, execute in /opt/bpe
    cd /opt/bpe/
    docker-compose up -d && docker-compose logs -f