Page 1 of 1

Repeated Workflow instance

PostPosted:Thu Aug 15, 2019 11:38 pm
by w12315007
Hi, we came accross a very strange issue during we developed a file workflow. We developed a file workflow with run_config and loaded it in openkm. The openkm created two repeated workflow instance with same created time when we executed the workflow. But we developed other file workflow without run_config,the openkm created a wokflow instance normally. we didn't what caused this issue, have any idea this?

May it is a bug?

PostPosted:Tue Aug 20, 2019 4:53 am
by w12315007
Hi, we debugged the source code for this problem,we found the program will run the following code when the workflow with run_config,
Code: Select all
	public void runProcessDefinition() {
		if (drawed) {
			if (manager.getValidationProcessor().validate()) {
				runProcessDefinitionWithValues();
			} else {
				workflowWidgetToFire.hasPendingProcessDefinitionForms();
			}
		} else {
			getProcessDefinitionForms(name);
		}
	}
the condition, manager.getValidationProcessor().validate(),will return true, so it will call runProcessDefinitionWithValues() which create a workflow instance, but manager.getValidationProcessor().validate() as following:
Code: Select all
public boolean validate(List<String> uuids, String... names) {
		this.uuids = uuids;
		result = true;
		pluginsValidated = 0;
		result = result && super.validate(names);
		// Always evaluate plugins rpc calls at ends
		if (plugins > 0 && validatorToFire != null) {
			waitUntilValidatorsFinished();
		} else if (plugins == 0 && validatorToFire != null) {
			validatorToFire.validationWithPluginsFinished(result);
		}
		return result;
	}
it will call the validatorToFire.validationWithPluginsFinished(result), this funciton also includes a runProcessDefinitionWithValues() as following:
Code: Select all
	public void validationWithPluginsFinished(boolean result) {
		if (result) {
			runProcessDefinitionWithValues();
		} else {
			workflowWidgetToFire.hasPendingProcessDefinitionForms();
		}
	}
it will again call runProcessDefinitionWithValues() which will create second workflow instance.
I did not understand function of manager.getValidationProcessor().validate(), so why it need call runProcessDefinitionWithValues() again. May it is a bug or my configuration issue?

Re: Repeated Workflow instance

PostPosted:Sat Aug 24, 2019 3:57 pm
by jllort
Add the issue with this explanation in https://github.com/openkm/document-management-system

It seems a bug.