Script task fails on clustered environment the first time

Hi,

we set up a process engine cluster sharing the same database. When we start the first node everything is fine, we can start a workflow with script task without problems. The script is part of the deployment. We are using 7.7.0 in a spring context running on Tomcat.

But I have to correct me it also fails on the first node. So it does not matter if we have one or more than one node. the first execution of the attached workflow always fails.

When we try to start the workflow for the first time, it always says it cannot find the deployed script resource. We could not track it quite down, but it seems that on the second node the the cache responsible for the deployments does not load all resources for a deployment, so the first time it fails. The list of resources in the DeploymentEntity only contains the workflow definitions, but no other resources belonging to the deployment. Why it works when we execute the workflow a second we are not sure, but then all resources are set correctly on the DeploymentEntitiy, so the scripting environment can find the script code.

Do we need to configure something else on the process engine configuration, so that on the second instance also all resources get catch up during the first execution of the workflow?

I have attached the workflow we use. Sadly I cannot add the used script as well, because I am not allowed to upload here.

simpleExternalScriptTest.bpmn (3.1 KB)

The script (script.groovy) we reference in the workflow contains the following code:

println("It Worked!")

Regards

Alex

Hi,

we did a deeper analysis and could track down the behaviour until the class DeploymentEntity.getResources().

In the first call the property resources in the DeploymentEntity is set with a map containing only the workflow resource, so the script resource cannot be find. In the second call the property resources is null so the code of the method getResources loads all resources from the database and the script gets executed correctly.

We start the process with this code:

ProcessInstance instance = runtimeService.startProcessInstanceByKey(workflowKey, <BusinessKey>, variables);

Regards

Alexander

I too have noticed similar problems which intermittently show up as failure to locate script resources. I haven’t been able to get to bottom of it. It would be great to resolve this.
Cheers
James

Hi,

when we change the workflow start activity to asynchronous execution before, it works without an error for the first time also.

So it seems that when we start a workflow without any asynchronous execution we get this problem, because then the DeploymentEntity is not correctly initialized with all resources that are belonging to that deployment. We did not yet find out why.

Perhaps the Process Engine is checking the workflow definition first and during that check it loads only the necessary resources for that check (resources belonging to that workflow). But after the check the resources of the DeploymentEntity are not cleared to load all resources, so the first time the script loading will fail. The clear does not happen perhaps, because the execution of the workflow runs in the same transaction/thread.

Regards

Alexander

Hi @Alexander,

It seems to be related to 1.

Cheers,
Roman

Hi Roman,

yes sounds similar, the only difference is, that we are using the Java interfaces to start the process.

Regards

Alexander