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

NPE: Cannot invoke "String.getBytes()" because "key" is null #9269

Closed
remcowesterhoud opened this issue May 2, 2022 · 5 comments · Fixed by #9361
Closed

NPE: Cannot invoke "String.getBytes()" because "key" is null #9269

remcowesterhoud opened this issue May 2, 2022 · 5 comments · Fixed by #9361
Assignees
Labels
area/reliability Marks an issue as related to improving the reliability of our software (i.e. it behaves as expected) kind/bug Categorizes an issue or PR as a bug severity/mid Marks a bug as having a noticeable impact but with a known workaround version:8.1.0-alpha2 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0

Comments

@remcowesterhoud
Copy link
Contributor

Describe the bug

Evaluating a decision results in a NullPointerException. The NPE occurs during evaluation of a decision. It appears to be iterating over a map of variables and breaks when it encounters a variable with the key null.

To Reproduce

Not sure

Expected behavior

No NPE should occur. If any null values are possible we should be able to deal with them.

Log/Stacktrace

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

Full Stacktrace

 java.lang.NullPointerException: Cannot invoke "String.getBytes()" because "key" is null
	at io.camunda.zeebe.feel.impl.FeelToMessagePackTransformer.$anonfun$writeValue$2(FeelToMessagePackTransformer.scala:50) ~[zeebe-feel-integration-8.0.0.jar:8.0.0]
	at scala.collection.immutable.Map$Map2.foreach(Map.scala:342) ~[scala-library-2.13.8.jar:?]
	at io.camunda.zeebe.feel.impl.FeelToMessagePackTransformer.writeValue(FeelToMessagePackTransformer.scala:49) ~[zeebe-feel-integration-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.feel.impl.FeelToMessagePackTransformer.$anonfun$writeValue$1(FeelToMessagePackTransformer.scala:42) ~[zeebe-feel-integration-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.feel.impl.FeelToMessagePackTransformer.$anonfun$writeValue$1$adapted(FeelToMessagePackTransformer.scala:42) ~[zeebe-feel-integration-8.0.0.jar:8.0.0]
	at scala.collection.immutable.List.foreach(List.scala:333) ~[scala-library-2.13.8.jar:?]
	at io.camunda.zeebe.feel.impl.FeelToMessagePackTransformer.writeValue(FeelToMessagePackTransformer.scala:42) ~[zeebe-feel-integration-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.feel.impl.FeelToMessagePackTransformer.toMessagePack(FeelToMessagePackTransformer.scala:27) ~[zeebe-feel-integration-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.dmn.impl.DmnScalaDecisionEngine.toMessagePack(DmnScalaDecisionEngine.java:170) ~[zeebe-dmn-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.dmn.impl.EvaluatedDmnScalaDecision.of(EvaluatedDmnScalaDecision.java:56) ~[zeebe-dmn-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.dmn.impl.DmnScalaDecisionEngine.lambda$getEvaluatedDecisions$1(DmnScalaDecisionEngine.java:162) ~[zeebe-dmn-8.0.0.jar:8.0.0]
	at scala.collection.immutable.List.foreach(List.scala:333) ~[scala-library-2.13.8.jar:?]
	at io.camunda.zeebe.dmn.impl.DmnScalaDecisionEngine.getEvaluatedDecisions(DmnScalaDecisionEngine.java:159) ~[zeebe-dmn-8.0.0.jar:8.0.0]
	at java.util.Optional.map(Unknown Source) ~[?:?]
	at io.camunda.zeebe.dmn.impl.DmnScalaDecisionEngine.evaluateDecisionById(DmnScalaDecisionEngine.java:105) ~[zeebe-dmn-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.evaluateDecisionInDrg(BpmnDecisionBehavior.java:182) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.lambda$evaluateDecision$3(BpmnDecisionBehavior.java:111) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.Either$Right.flatMap(Either.java:366) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnDecisionBehavior.evaluateDecision(BpmnDecisionBehavior.java:109) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor$CalledDecisionBehavior.lambda$onActivate$0(BusinessRuleTaskProcessor.java:89) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.Either$Right.flatMap(Either.java:366) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor$CalledDecisionBehavior.onActivate(BusinessRuleTaskProcessor.java:89) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor.onActivate(BusinessRuleTaskProcessor.java:40) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.task.BusinessRuleTaskProcessor.onActivate(BusinessRuleTaskProcessor.java:21) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.lambda$processEvent$2(BpmnStreamProcessor.java:128) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.Either$Right.ifRightOrLeft(Either.java:381) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.processEvent(BpmnStreamProcessor.java:127) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.lambda$processRecord$0(BpmnStreamProcessor.java:110) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.Either$Right.ifRightOrLeft(Either.java:381) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.bpmn.BpmnStreamProcessor.processRecord(BpmnStreamProcessor.java:107) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.streamprocessor.TypedRecordProcessor.processRecord(TypedRecordProcessor.java:54) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.lambda$processInTransaction$3(ProcessingStateMachine.java:300) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.db.impl.rocksdb.transaction.ZeebeTransaction.run(ZeebeTransaction.java:84) ~[zeebe-db-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.processInTransaction(ProcessingStateMachine.java:290) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.processCommand(ProcessingStateMachine.java:253) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.tryToReadNextRecord(ProcessingStateMachine.java:213) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.readNextRecord(ProcessingStateMachine.java:189) ~[zeebe-workflow-engine-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.sched.ActorJob.invoke(ActorJob.java:79) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.sched.ActorJob.execute(ActorJob.java:44) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.sched.ActorTask.execute(ActorTask.java:122) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.sched.ActorThread.executeCurrentTask(ActorThread.java:97) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.sched.ActorThread.doWork(ActorThread.java:80) ~[zeebe-util-8.0.0.jar:8.0.0]
	at io.camunda.zeebe.util.sched.ActorThread.run(ActorThread.java:189) ~[zeebe-util-8.0.0.jar:8.0.0] 

Environment:

  • OS: Camunda Cloud
  • Zeebe Version: Seen in 8.0.0 and 8.0.1
@remcowesterhoud remcowesterhoud added kind/bug Categorizes an issue or PR as a bug area/reliability Marks an issue as related to improving the reliability of our software (i.e. it behaves as expected) team/process-automation labels May 2, 2022
@remcowesterhoud
Copy link
Contributor Author

@saig0 You might be interested in this one. I haven't been able to fully analyse where the problem was coming from.

@saig0
Copy link
Member

saig0 commented May 3, 2022

@remcowesterhoud I'm also not sure how to reproduce it 😅 The issue seems to be in the DMN engine.

It would be good to see the DMN that was evaluated. Can we get the DMN from the cluster for root cause analysis?

@npepinpe
Copy link
Member

npepinpe commented May 3, 2022

@remcowesterhoud please try to get the the DMN to further analyze this.

The expected impact here is that the instance is blacklisted, so not visible to the user, but the cluster will keep "working". We also expect likelihood here to be low, as no one ran into this so far. I'll mark it as blocker/info and severity/mid for now, but tentatively, and once we have the DMN we should revise this.

@npepinpe npepinpe added blocker/info Marks an issue as blocked, awaiting more information from the author severity/mid Marks a bug as having a noticeable impact but with a known workaround labels May 3, 2022
@remcowesterhoud
Copy link
Contributor Author

remcowesterhoud commented May 3, 2022

I have identified and reproduced the issue. See camunda/dmn-scala#142

@saig0 saig0 removed the blocker/info Marks an issue as blocked, awaiting more information from the author label May 6, 2022
@remcowesterhoud remcowesterhoud self-assigned this May 11, 2022
@remcowesterhoud
Copy link
Contributor Author

Will be fixed by #9361

zeebe-bors-camunda bot added a commit that referenced this issue May 12, 2022
9361: deps(maven): bump dmn-engine from 1.7.1 to 1.7.2 r=remcowesterhoud a=dependabot[bot]

Bumps [dmn-engine](https://github.com/camunda-community-hub/dmn-scala) from 1.7.1 to 1.7.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/camunda-community-hub/dmn-scala/releases">dmn-engine's releases</a>.</em></p>
<blockquote>
<h2>v.1.7.2</h2>
<h2>What's Changed</h2>
<ul>
<li>feat: inject clock in the engine builder by <a href="https://github.com/korthout"><code>`@​korthout</code></a>` in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/127">camunda-community-hub/dmn-scala#127</a></li>
<li>fix: reject invalid decision table with empty output name by <a href="https://github.com/remcowesterhoud"><code>`@​remcowesterhoud</code></a>` in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/143">camunda-community-hub/dmn-scala#143</a></li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>chore(deps): bump log4j-api from 2.14.1 to 2.16.0 by <a href="https://github.com/dependabot"><code>`@​dependabot</code></a>` in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/124">camunda-community-hub/dmn-scala#124</a></li>
<li>chore(deps): bump log4j-api from 2.16.0 to 2.17.0 by <a href="https://github.com/dependabot"><code>`@​dependabot</code></a>` in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/125">camunda-community-hub/dmn-scala#125</a></li>
<li>chore(deps): bump log4j-core from 2.14.1 to 2.17.1 by <a href="https://github.com/dependabot"><code>`@​dependabot</code></a>` in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/130">camunda-community-hub/dmn-scala#130</a></li>
<li>chore(deps): bump log4j-api from 2.17.0 to 2.17.1 by <a href="https://github.com/dependabot"><code>`@​dependabot</code></a>` in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/131">camunda-community-hub/dmn-scala#131</a></li>
<li>chore(deps): bump netty-bom from 4.1.37.Final to 4.1.73.Final by <a href="https://github.com/dependabot"><code>`@​dependabot</code></a>` in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/133">camunda-community-hub/dmn-scala#133</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/korthout"><code>`@​korthout</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/127">camunda-community-hub/dmn-scala#127</a></li>
<li><a href="https://github.com/barmac"><code>`@​barmac</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/137">camunda-community-hub/dmn-scala#137</a></li>
<li><a href="https://github.com/remcowesterhoud"><code>`@​remcowesterhoud</code></a>` made their first contribution in <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/pull/143">camunda-community-hub/dmn-scala#143</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/camunda-community-hub/dmn-scala/compare/1.7.1...1.7.2">https://github.com/camunda-community-hub/dmn-scala/compare/1.7.1...1.7.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/c23478d923ce8cf81ca6c3d6e5e00a381c577aaa"><code>c23478d</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/issues/143">#143</a> from camunda-community-hub/remco-142-empty_output_names</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/3efea67e5838a8b01d2bd7392bcfbc9a64a601fb"><code>3efea67</code></a> fix: fail early on empty output name for decision table</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/5dc74880579ab560527ce2af1e8fd4a7b34db687"><code>5dc7488</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/issues/139">#139</a> from barmac/patch-2</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/fd1365f865e049c746777a3a3e0d661e3708d24a"><code>fd1365f</code></a> chore: update function provider SPI link</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/7e3ca32d3189c4d9ee82801ef553c59e18f445b5"><code>7e3ca32</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/issues/137">#137</a> from barmac/patch-1</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/586c38b298f543bf6c29728415c8f7085395e666"><code>586c38b</code></a> chore: update value mapper link</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/14d12c8e04fc6a1bcd6b3bbabd75bfc21113c0c5"><code>14d12c8</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/issues/133">#133</a> from camunda-community-hub/dependabot/maven/io.netty-...</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/f2efdf43d3734c8e7a2d65b7c5a59f80a1ecfeec"><code>f2efdf4</code></a> chore(deps): bump netty-bom from 4.1.37.Final to 4.1.73.Final</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/5abb9508cbc2403a7ed8741153449474e4ea27bf"><code>5abb950</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/camunda-community-hub/dmn-scala/issues/131">#131</a> from camunda-community-hub/dependabot/maven/org.apach...</li>
<li><a href="https://github.com/camunda-community-hub/dmn-scala/commit/57528d09b8cbc78d5825ce1afb0f4eac11e42054"><code>57528d0</code></a> chore(deps): bump log4j-api from 2.17.0 to 2.17.1</li>
<li>Additional commits viewable in <a href="https://github.com/camunda-community-hub/dmn-scala/compare/1.7.1...1.7.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.camunda.bpm.extension.dmn.scala:dmn-engine&package-manager=maven&previous-version=1.7.1&new-version=1.7.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

closes #9269

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
zeebe-bors-camunda bot added a commit that referenced this issue Aug 2, 2022
9944: fix(deps): bump dmn-scala from 1.7.1 to 1.7.2 r=saig0 a=remcowesterhoud

## Description

Backport of #9361 to `stable/8.0`.

relates to #9269

---

We had an issue in the DMN engine which was the cause of NPE. This was resolved in #9269 but it wasn't backported to the 8.0 branch.


Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
@Zelldon Zelldon added the version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0 label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/reliability Marks an issue as related to improving the reliability of our software (i.e. it behaves as expected) kind/bug Categorizes an issue or PR as a bug severity/mid Marks a bug as having a noticeable impact but with a known workaround version:8.1.0-alpha2 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants