Comments (4)
The fetchVariables being false is the right value in this case, as not all variables should be fetched when only one variable is set.
If the variable is not in the cache and the variableInstances are empty, we're in the 'else' clause here: https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/activiti/engine/impl/persistence/entity/VariableScopeImpl.java#L686. At that point the getSpecificVariable is called, which only fetched the one variable. The createVariableInstance should not be called.
So my guess is that, since you mention nested workflows, something goes wrong here with the executionId that is being used here. I've tried with a few simple processes here, but was unable to reproduce. It would help a lot if you could post an example process definition / structure where you see this problem.
from flowable-engine.
Thank you very much for your quick response. Actually, we also depend on RuntimeService#setVariable
to create the variable instance. I should have stressed that. We want the call to createVariableInstance
to happen because getSpecificVariable
returns null
. It's just that the new variable instance seems to be limited to a very small scope now.
Unfortunately our workflow definitions are confidential and rather complex and I didn't get the time budget to extract a test case that shows the problem. So these are all the details I can provide, at least for now.
from flowable-engine.
Ok, thanks for the clarification around createVariableInstance, that makes it indeed a bit clearer.
How are you calling the runtimeService#setVariable ? Are you calling this from within a JavaDelegate or ActivityBehavior?
In what kind of context is the setVariable called? You mention that the scope is more limited now, from which I infer that you use the variable somehow directly after that and that it's failing now?
No problem about not being able to share the workflow definition, that happens often ;-). But it would help here if you could explain what you mean with 'nested workflows' and how/when the setVariable is called when it's failing.
from flowable-engine.
With nested workflow I mean that we use a <callActivity> to start a sub-process, but at the moment I don't think that having this kind of nesting is necessary to reproduce the bug.
We set the execution explicitly and set the variables like this:
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Execution ex =
runtimeService.createExecutionQuery().executionId(task.getProcessInstanceId()).singleResult();
try {
setExecutionContext((InterpretableExecution) ex);
runtimeService.setVariable(ex.getId(), "variableName", someValue);
I guess we do this because of an issue in version 5.9. A comment indicates that we would rather use CDI.
After that we complete the task and need the variable during its completion.
// We need the variable in a TaskListener.
taskService.complete(taskId);
} finally {
removeExecutionContext();
}
The funny thing is that it works when we insert the following just between the setVariable
and the call to complete
:
if (Context.getCommandContext() != null && Context.getCommandContext().getDbSqlSession() != null) {
Context.getCommandContext().getDbSqlSession().flush();
}
Do we have to flush manually if we set the execution manually? We don't set the command context explicitly, however.
I found out about this flush because our test case runs two completions, one without a command context reuse (CommandContextInterceptor line 65) and one with a command context reuse. The call without the context reuse triggered a flush, the other one didn't.
from flowable-engine.
Related Issues (20)
- realease6.8.1 has a bug ,because The rollback Cannot roll back correctly in the case of multiple instances,please fix soon HOT 1
- flowable-ui的版本和flowable-engine的版本不太一致
- Delay in seconds before script condition executed HOT 6
- task complete before report NoSuchMethodError: org.flowable.bpmn.model.UserTask.getTaskCompleterVariableName() , flowable version: 7.0.1 HOT 2
- Flowable 7.0.1 not getting installed in ecliupse HOT 1
- Conditions should support more than JUEL expressions
- suspendProcessInstanceById question
- BpmnXMLUtil.parseExtensionElement setElementText has bug of Line wrap cover HOT 1
- Process migration cannot migrate processes HOT 1
- Process definition id of an async external worker service task job is not updated after direct migration HOT 2
- 是否有审批人驳回到上级,上级修改后在发起继续审批流程 HOT 1
- Invalid SQL upgrade scripts for HSQL database (7.0.0 -> 7.0.1)
- The DefaultIdentityLinkIterceptor.java creates duplicate identityLinks on ProcessInstance
- AsyncTaskInvokerTaskExecutor supplied by Spring Boot autoconfiguration is not started
- Not possible to exclude the `flowable-event-registry` JAR even if EventRegistry disabled
- startProcessInstanceByKey does not always trigger the process HOT 3
- Liquibase first up does not work with JtaProcessEngineConfiguration HOT 1
- Timer job never unlocked after an exception
- Query the sorting exception of HistoricActivityInstance
- After running runtimeService().deleteProcessInstance(processInstance.getId()) to delete the parent process instance, the CallActivity subprocessInstance query is null HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flowable-engine.