Adobe-Consulting-Services / acs-aem-commons

http://adobe-consulting-services.github.io/acs-aem-commons/
Apache License 2.0
454 stars 600 forks source link

Workflow Delegation step does not delegate to transient workflow #2296

Closed danxchapman closed 4 years ago

danxchapman commented 4 years ago

Required Information

Expected Behavior

Workflow Delegation step delegates to transient workflow

Actual Behavior

Workflow Delegation step does not delegate to transient workflow

Steps to Reproduce

davidjgonzalez commented 4 years ago

@danxchapman can you setup a DEBUG logger for com.adobe.acs.commons.workflow.process.impl and do this and post the logs?

Also, can you confirm what you're passing in as the PROCESS_ARGS?


* workflowModelProperty=<propName>
* defaultWorkflowModel=<pathToDefaultWorkflowModel>
* terminateWorkflowOnDelegation=true|false
``

Also, are you sure the workflowModelProperty is correctly set on your content tree? and/or are you using the defaultWorkflowModel -- if so, what is the path you are using?

WF's location moved around in 6.4, and i think you need to point to the `/var/workflow/models/...` workflow node for this to resolve correctly (since that's the runtime model).
joerghoh commented 4 years ago

I worked on this issue and came out with a way to cause an issue (not sure if this is the one @danxchapman was meaning).

(I know that this new workflow doesn't make any sense, but I just used it as vehicle to call a random transient workflow.)

Then I got these messages:

15.05.2020 19:54:57.057 *DEBUG* [JobHandler: /var/workflow/instances/server0/2020-05-15/request_for_deletion_8:/content/dam/global/products/phb7_4_heizung.pdf] com.adobe.acs.commons.workflow.process.impl.WorkflowDe
legationStep Provided PROCESS_ARGS: propertyName = [ foo ], Default Workflow Model = [ /var/workflow/models/dam/update_asset ]
15.05.2020 19:54:57.058 *DEBUG* [JobHandler: /var/workflow/instances/server0/2020-05-15/request_for_deletion_8:/content/dam/global/products/phb7_4_heizung.pdf] com.adobe.acs.commons.workflow.process.impl.WorkflowDe
legationStep Using default delegate Workflow Model [ /var/workflow/models/dam/update_asset ]
15.05.2020 19:54:57.068 *ERROR* [JobHandler: /var/workflow/instances/server0/2020-05-15/request_for_deletion_8:/content/dam/global/products/phb7_4_heizung.pdf] org.apache.sling.event.impl.jobs.JobManagerImpl Except
ion during persisting new job 'Sling Job [topic=com/adobe/granite/workflow/transient/job/var/workflow/models/dam/update_asset, properties=transient.workflowDataPayload=/content/dam/global/products/phb7_4_heizung.pd
f,transient.metadata={},transient.modelPath=/var/workflow/models/dam/update_asset,transient.workflowDataMetaData={workflowTitle=, currentJobs=VolatileWorkItem_node1_var_workflow_instances_server0_2020-05-15_request_for_d
eletion_8, startComment=},transient.workflowDataPayloadType=JCR_PATH]'
org.apache.sling.api.resource.PersistenceException: Value can't be stored in the repository: {workflowTitle=, currentJobs=VolatileWorkItem_node1_var_workflow_instances_server0_2020-05-15_request_for_deletion_8, startComment=}
        at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.create(JcrResourceProvider.java:472) [org.apache.sling.jcr.resource:3.0.18]
        at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.create(AuthenticatedResourceProvider.java:182) [org.apache.sling.resourceresolver:1.6.8]
        at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.create(ResourceResolverControl.java:379) [org.apache.sling.resourceresolver:1.6.8]
        at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.create(ResourceResolverImpl.java:971) [org.apache.sling.resourceresolver:1.6.8]
        at org.apache.sling.api.resource.ResourceUtil.getOrCreateResourceInternal(ResourceUtil.java:666) [org.apache.sling.api:2.20.0]
        at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:603) [org.apache.sling.api:2.20.0]
        at org.apache.sling.event.impl.support.ResourceHelper.createAndCommitResource(ResourceHelper.java:277) [org.apache.sling.event:4.2.12]
        at org.apache.sling.event.impl.jobs.JobManagerImpl.writeJob(JobManagerImpl.java:641) [org.apache.sling.event:4.2.12]
        at org.apache.sling.event.impl.jobs.JobManagerImpl.addJobInternal(JobManagerImpl.java:569) [org.apache.sling.event:4.2.12]
        at org.apache.sling.event.impl.jobs.JobManagerImpl.addJob(JobManagerImpl.java:722) [org.apache.sling.event:4.2.12]
        at org.apache.sling.event.impl.jobs.JobBuilderImpl.add(JobBuilderImpl.java:59) [org.apache.sling.event:4.2.12]
        at com.adobe.granite.workflow.core.WorkflowSessionImpl.addJob(WorkflowSessionImpl.java:1621) [com.adobe.granite.workflow.core:2.0.240.CQ650-B0002]
        at com.adobe.granite.workflow.core.WorkflowSessionImpl.startWorkflow(WorkflowSessionImpl.java:1568) [com.adobe.granite.workflow.core:2.0.240.CQ650-B0002]
        at com.adobe.granite.workflow.core.WorkflowSessionImpl.startWorkflow(WorkflowSessionImpl.java:509) [com.adobe.granite.workflow.core:2.0.240.CQ650-B0002]
        at com.adobe.acs.commons.workflow.process.impl.WorkflowDelegationStep.execute(WorkflowDelegationStep.java:155)
        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:195) [com.adobe.granite.workflow.core:2.0.240.CQ650-B0002]
        at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:260) [com.adobe.granite.workflow.core:2.0.240.CQ650-B0002]
        at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502) [org.apache.sling.event:4.2.12]
        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:293) [org.apache.sling.event:4.2.12]
        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60) [org.apache.sling.event:4.2.12]
        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:229) [org.apache.sling.event:4.2.12]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Value can't be stored in the repository: {workflowTitle=, currentJobs=VolatileWorkItem_node1_var_workflow_instances_server0_2020-05-15_request_for_deletion_8, startComment=}
        at org.apache.sling.jcr.resource.internal.helper.JcrPropertyMapCacheEntry.failIfCannotStore(JcrPropertyMapCacheEntry.java:108) [org.apache.sling.jcr.resource:3.0.18]
        at org.apache.sling.jcr.resource.internal.helper.JcrPropertyMapCacheEntry.<init>(JcrPropertyMapCacheEntry.java:95) [org.apache.sling.jcr.resource:3.0.18]
        at org.apache.sling.jcr.resource.internal.JcrModifiableValueMap.put(JcrModifiableValueMap.java:445) [org.apache.sling.jcr.resource:3.0.18]
        at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.create(JcrResourceProvider.java:465) [org.apache.sling.jcr.resource:3.0.18]
        ... 23 common frames omitted

@danxchapman is this the exception you saw as well?

joerghoh commented 4 years ago

see #2305 for a fix, which allows me to complete the above mentioned scenario succesfully. Needs some further testing, as I haven't tested yet if the delegation to a "standard" (non-transient) workflows works as well with it.