flowable / flowable/flowable-engine

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

Offen
#3,606 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
9.5k
Forks
2.9k
Ø Merge
7 Std. 8 Min.
Gemergte PRs (30 T.)
2

Beschreibung

**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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDecisionsForProcessDefinitionCmd.java, insbesondere mit getDecisionsFromModel und addDecisionToCollection, und verfolge anschließend RepositoryServiceImpl.getDecisionsForProcessDefinition. Reproduziere den Fall mit mehreren Mandanten und doppelten Schlüsseln und überprüfe, dass die neueste Decision desselben Mandanten zurückgegeben wird, mit Fallback auf den Default-Mandanten nur, wenn dieser aktiviert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.