flowable / flowable/flowable-engine

DMN engine bug: `RepositoryServiceImpl.getDecisionsForProcessDefinition` throw an exception when the same decision key is used by multiple tenants

Open
#3,606 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

**Describe the bug**
`RepositoryServiceImpl.getDecisionsForProcessDefinition` throws an exception when there are multiple decisions with the same key and version.

Example stack trace:

```
root org.flowable.common.engine.api.FlowableException: Query return 3 results instead of max 1
root at org.flowable.common.engine.impl.query.AbstractQuery.executeSingleResult(AbstractQuery.java:184)
root at org.flowable.common.engine.impl.query.AbstractQuery.execute(AbstractQuery.java:164)
root at org.flowable.dmn.engine.impl.interceptor.DmnCommandInvoker$1.run(DmnCommandInvoker.java:45)
root at org.flowable.dmn.engine.impl.interceptor.DmnCommandInvoker.executeOperations(DmnCommandInvoker.java:62)
root at org.flowable.dmn.engine.impl.interceptor.DmnCommandInvoker.execute(DmnCommandInvoker.java:49)
root at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
root at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:105)
root at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
root at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
root at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
root at org.flowable.common.engine.impl.query.AbstractQuery.singleResult(AbstractQuery.java:105)
root at org.flowable.engine.impl.cmd.GetDecisionsForProcessDefinitionCmd.addDecisionToCollection(GetDecisionsForProcessDefinitionCmd.java:115)
root at org.flowable.engine.impl.cmd.GetDecisionsForProcessDefinitionCmd.getDecisionsFromModel(GetDecisionsForProcessDefinitionCmd.java:86)
root at org.flowable.engine.impl.cmd.GetDecisionsForProcessDefinitionCmd.execute(GetDecisionsForProcessDefinitionCmd.java:69)
root at org.flowable.engine.impl.cmd.GetDecisionsForProcessDefinitionCmd.execute(GetDecisionsForProcessDefinitionCmd.java:1)
root at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:67)
root at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:140)
root at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:114)
root at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:72)
root at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:26)
root at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
root at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:105)
root at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
root at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
root at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
root at org.flowable.engine.impl.RepositoryServiceImpl.getDecisionsForProcessDefinition(RepositoryServiceImpl.java:373)

```

This [method here](https://github.com/flowable/flowable-engine/blob/2ae0f8974074b031df609dea2bc942426660d326/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDecisionsForProcessDefinitionCmd.java#L99) has multiple problems:

1. it should **not** by default look for decisions in the same deployment as the process
2. it should only look for decisions which belong to the same tenant as the process; alternatively it should look for the same decision key in the default tenant decisions in case "fallback to default tenant" is enabled.

**Expected behavior**
Return the latest version of decisions referenced by the process. When the "fallback to default tenant" option is enabled, return the latest version of the decision with the same key from the default tenant.

**Additional context**
Version: v.6.7.2.32.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.