Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeebe Test Engine throws IllegalStateException when ending a process with a Terminate End Event #893

Closed
VonDerBeck opened this issue Sep 14, 2023 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@VonDerBeck
Copy link

Description

Given the following sample process:

grafik

In a process unit test using the embedded Zeebe Test Engine (zeebe-process-test-extension) I get the following error upon completing the User Task which is followed by the Terminate End Event:

2023-09-14T13:15:51.228+02:00 ERROR 15152 --- [    zb-actors-5] io.camunda.zeebe.broker.process          : Expected to process record 'TypedRecordImpl{metadata=RecordMetadata{recordType=COMMAND, valueType=JOB, intent=COMPLETE}, value={"deadline":-1,"worker":"","retries":-1,"retryBackoff":0,"recurringTime":-1,"type":"","customHeaders":[packed value (length=1)],"variables":"gA==","errorMessage":"","errorCode":"","bpmnProcessId":"","processDefinitionVersion":-1,"processDefinitionKey":-1,"processInstanceKey":-1,"elementId":"","elementInstanceKey":-1}}' without errors, but exception occurred with message 'Expected the child count to be positive but was -1'.

java.lang.IllegalStateException: Expected the child count to be positive but was -1
	at io.camunda.zeebe.engine.state.instance.ElementInstance.decrementChildCount(ElementInstance.java:111) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.state.instance.DbElementInstanceState.removeInstance(DbElementInstanceState.java:163) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.state.appliers.ProcessInstanceElementTerminatedApplier.applyState(ProcessInstanceElementTerminatedApplier.java:41) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.state.appliers.ProcessInstanceElementTerminatedApplier.applyState(ProcessInstanceElementTerminatedApplier.java:19) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.state.appliers.EventAppliers.applyState(EventAppliers.java:302) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.processing.streamprocessor.writers.ResultBuilderBackedEventApplyingStateWriter.appendFollowUpEvent(ResultBuilderBackedEventApplyingStateWriter.java:41) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnStateTransitionBehavior.transitionTo(BpmnStateTransitionBehavior.java:219) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnStateTransitionBehavior.transitionToTerminated(BpmnStateTransitionBehavior.java:209) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]
	at io.camunda.zeebe.engine.processing.bpmn.task.JobWorkerTaskProcessor.lambda$onTerminate$10(JobWorkerTaskProcessor.java:96) ~[zeebe-workflow-engine-8.2.13.jar:8.2.13]

I do not get these weird exceptions in case the end event is a simple End Event.

Expected behaviour

Completing a User Task followed by a Terminate End Event should not lead to a IllegalStateException when testing my process with the embedded test engine.

Reproduction steps

Run ProcessUnitTest in the following Maven project:

camunda-8-terminate-event.zip

Environment

  • OS: Windows 10
  • Zeebe 8.2.13, Java 17, Spring Boot 3.0.5
@VonDerBeck VonDerBeck added the kind/bug Categorizes issue or PR as related to a bug. label Sep 14, 2023
@namero999
Copy link

Most likely related #876

@korthout
Copy link
Member

Thanks @VonDerBeck for raising this.

I'm closing this in favor of #876 as this is a duplicate. The reproducible example is useful. I'll make sure to track it in the other issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants