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

Writing a DecisionEvaluationResult fails because EvaluatedInput.inputName() is null #8909

Closed
lenaschoenburg opened this issue Mar 15, 2022 · 3 comments · Fixed by #8919
Closed
Assignees
Labels
kind/bug Categorizes an issue or PR as a bug

Comments

@lenaschoenburg
Copy link
Member

Describe the bug

Error: https://console.cloud.google.com/errors/detail/CIHdh_bs1r-nDQ;service=zeebe;time=P7D?project=camunda-cloud-240911

Expected behavior

Log/Stacktrace

Full Stacktrace

 java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "value" is null
	at io.camunda.zeebe.util.StringUtil.getBytes(StringUtil.java:39) ~[zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.StringUtil.getBytes(StringUtil.java:35) ~[zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.msgpack.property.StringProperty.setValue(StringProperty.java:30) ~[zeebe-msgpack-value-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.protocol.impl.record.value.decision.EvaluatedInputRecord.setInputName(EvaluatedInputRecord.java:46) ~[zeebe-protocol-impl-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.addInputToEvaluationEvent(BpmnDecisionBehavior.java:296) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.lambda$addDecisionToEvaluationEvent$8(BpmnDecisionBehavior.java:282) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at java.util.ArrayList.forEach(Unknown Source) ~[?:?]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.addDecisionToEvaluationEvent(BpmnDecisionBehavior.java:281) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.lambda$writeDecisionEvaluationEvent$7(BpmnDecisionBehavior.java:242) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at java.util.ArrayList.forEach(Unknown Source) ~[?:?]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.writeDecisionEvaluationEvent(BpmnDecisionBehavior.java:240) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.lambda$evaluateDecision$3(BpmnDecisionBehavior.java:114) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.Either$Right.flatMap(Either.java:366) ~[zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.evaluateDecision(BpmnDecisionBehavior.java:109) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor$CalledDecisionBehavior.lambda$onActivate$0(BusinessRuleTaskProcessor.java:89) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.Either$Right.flatMap(Either.java:366) ~[zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor$CalledDecisionBehavior.onActivate(BusinessRuleTaskProcessor.java:89) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor.onActivate(BusinessRuleTaskProcessor.java:40) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor.onActivate(BusinessRuleTaskProcessor.java:21) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.lambda$processEvent$2(BpmnStreamProcessor.java:128) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.Either$Right.ifRightOrLeft(Either.java:381) ~[zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.processEvent(BpmnStreamProcessor.java:127) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.lambda$processRecord$0(BpmnStreamProcessor.java:110) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.Either$Right.ifRightOrLeft(Either.java:381) ~[zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.processRecord(BpmnStreamProcessor.java:107) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.streamprocessor.TypedRecordProcessor.processRecord(TypedRecordProcessor.java:54) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.lambda$processInTransaction$3(ProcessingStateMachine.java:297) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.db.impl.rocksdb.transaction.ZeebeTransaction.run(ZeebeTransaction.java:84) ~[zeebe-db-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.processInTransaction(ProcessingStateMachine.java:287) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.processCommand(ProcessingStateMachine.java:252) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.tryToReadNextRecord(ProcessingStateMachine.java:212) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.readNextRecord(ProcessingStateMachine.java:188) ~[zeebe-workflow-engine-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.sched.ActorJob.invoke(ActorJob.java:79) [zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.sched.ActorJob.execute(ActorJob.java:44) [zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.sched.ActorTask.execute(ActorTask.java:122) [zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.sched.ActorThread.executeCurrentTask(ActorThread.java:97) [zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.sched.ActorThread.doWork(ActorThread.java:80) [zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2]
	at io.camunda.zeebe.util.sched.ActorThread.run(ActorThread.java:189) [zeebe-util-1.4.0-alpha2.jar:1.4.0-alpha2] 

Environment:

  • Zeebe Version: 1.4.0-alpha2
@lenaschoenburg lenaschoenburg added the kind/bug Categorizes an issue or PR as a bug label Mar 15, 2022
@npepinpe
Copy link
Member

@korthout - could we have a look at this and see if this is a quick fix for 1.4?

korthout added a commit that referenced this issue Mar 15, 2022
The decision engine can evaluate decisions where the inputs and outputs
of a decision table don't have names (or labels). In that case the name
property is null. We can't write null in records, instead we should
write an empty string "".

See #8909
@korthout korthout added this to In progress in Zeebe Mar 15, 2022
@korthout
Copy link
Member

Thanks for reporting @oleschoenburg.

I think this is a bug. Alternatively, it could have been a case where we simply want to add a deployment validator, but I think we want to support this case.

I've created a fix for it, but I'm keeping it in draft until I've confirmed that we consider this a valid decision model.

@korthout
Copy link
Member

As far as I can tell, this is indeed a bug.

For inputs, the spec does not define names. Labels can be attached but are optional. We use the label as a way to display names for inputs in the modeler. Naming inputs is something Camunda does but is not officially part of the DMN spec.

For outputs, names are part of the DMN spec. They are only mandatory for decision tables with multiple outputs. So single output decision tables can leave out the output name.

So in my opinion, the case above is a bug and it is fixed by allowing inputs and outputs without names (or labels). I'll mark the PR as ready for review.

@npepinpe npepinpe moved this from In progress to Review in progress in Zeebe Mar 16, 2022
korthout added a commit that referenced this issue Mar 21, 2022
The decision engine can evaluate decisions where the inputs and outputs
of a decision table don't have names (or labels). In that case the name
property is null. We can't write null in records, instead we should
write an empty string "".

See #8909
ghost pushed a commit that referenced this issue Mar 21, 2022
8919: Support decision table inputs and outputs without names/labels r=korthout a=korthout

## Description

<!-- Please explain the changes you made here. -->
A decision tables' inputs and outputs must have an id and can have a name. The name (or label) is not mandatory.

Even though the internal decision engine was already able to deal with this, the workflow engine wasn't. It would try to write the EvaluationEvent record with an EvaluatedInputRecord (or EvaluatedOutputRecord) and then fail writing it because of a NullPointerException.

This makes sure these records can be written when the name of the input or output is undefined.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #8909



Co-authored-by: Nico Korthout <nico.korthout@camunda.com>
ghost pushed a commit that referenced this issue Mar 21, 2022
8919: Support decision table inputs and outputs without names/labels r=korthout a=korthout

## Description

<!-- Please explain the changes you made here. -->
A decision tables' inputs and outputs must have an id and can have a name. The name (or label) is not mandatory.

Even though the internal decision engine was already able to deal with this, the workflow engine wasn't. It would try to write the EvaluationEvent record with an EvaluatedInputRecord (or EvaluatedOutputRecord) and then fail writing it because of a NullPointerException.

This makes sure these records can be written when the name of the input or output is undefined.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #8909



8939: refactor: use foreign keys for decisions r=oleschoenburg a=oleschoenburg

## Description

Uses `DbForeignKey` internally to maintain referential integrity within `DbDecisionState`

relates to #8930 

Co-authored-by: Nico Korthout <nico.korthout@camunda.com>
Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
ghost pushed a commit that referenced this issue Mar 21, 2022
8919: Support decision table inputs and outputs without names/labels r=korthout a=korthout

## Description

<!-- Please explain the changes you made here. -->
A decision tables' inputs and outputs must have an id and can have a name. The name (or label) is not mandatory.

Even though the internal decision engine was already able to deal with this, the workflow engine wasn't. It would try to write the EvaluationEvent record with an EvaluatedInputRecord (or EvaluatedOutputRecord) and then fail writing it because of a NullPointerException.

This makes sure these records can be written when the name of the input or output is undefined.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #8909



Co-authored-by: Nico Korthout <nico.korthout@camunda.com>
ghost pushed a commit that referenced this issue Mar 21, 2022
8919: Support decision table inputs and outputs without names/labels r=korthout a=korthout

## Description

<!-- Please explain the changes you made here. -->
A decision tables' inputs and outputs must have an id and can have a name. The name (or label) is not mandatory.

Even though the internal decision engine was already able to deal with this, the workflow engine wasn't. It would try to write the EvaluationEvent record with an EvaluatedInputRecord (or EvaluatedOutputRecord) and then fail writing it because of a NullPointerException.

This makes sure these records can be written when the name of the input or output is undefined.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #8909



Co-authored-by: Nico Korthout <nico.korthout@camunda.com>
@ghost ghost closed this as completed in 2027d53 Mar 22, 2022
Zeebe automation moved this from Review in progress to Done Mar 22, 2022
@KerstinHebel KerstinHebel removed this from Done in Zeebe Mar 23, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes an issue or PR as a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants