Highlighted

Workflow seems to execute multiple times on Node Created

Avatar

Avatar

bobbym33667819

Avatar

bobbym33667819

bobbym33667819

04-10-2018

Hello,

We have a case where one of our workflows seems to fail occasionally. The workflow is launched on Node Created with node type nt:file and path: /content/dam(/.*/)renditions/original. One of the tasks of the workflow is to notify users that an asset has been uploaded by sending notification to their inbox. This is the steps that seems to fail due to the fact that job has been done already and they indeed have notification for that asset already. The cause seems to be

Caused by: javax.jcr.ItemExistsException: node3_etc_workflow_instances_server0_2018-10-01_1_upload-asset_555 (Check full error below)

The step before the one described is a script that checks if the asset is not a sub-asset.

function check() {

  log.debug("---------- Executing: Sub-Asset Check ----------");

  var payload = workflowData.getPayload().toString();

  var retVal = false;

 

  log.debug("Payload: " + payload);

  if(payload.indexOf("/subassets/") > -1) {

  retVal = true;

    log.debug("\tIs a sub asset.");

  }//if

  return retVal;

}//end function check

If we remove that step we don't see the occasional failures. The failures seem to be on different assets each time we upload the same group of assets. Is there a cause to think that the workflow can be executed more that once on node created or that this particular step that checks for sub-assets can cause the next step to be executed more than once?

Our model:

Screen Shot 2018-10-04 at 12.24.33 PM.png

04.10.2018 11:40:58.366 *ERROR* [JobHandler: /etc/workflow/instances/server0/2018-10-01_1/upload-asset_555:/content/dam/.../photography/room-scenes/entryway/Entryway 0012 Detail A Alt 02.tif/jcr:content/renditions/original] com.adobe.granite.workflow.core.job.JobHandler Error executing workflow step

com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:199)

        at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:258)

        at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        at java.lang.Thread.run(Unknown Source)

Caused by: com.adobe.granite.workflow.WorkflowException: Cannot add WorkItem to asset-taggers's inbox

        at com.adobe.granite.workflow.core.jcr.WorkItemManager.addWorkItem(WorkItemManager.java:204)

        at com.adobe.granite.workflow.core.jcr.WorkItemManager.addWorkItem(WorkItemManager.java:111)

        at com.adobe.granite.workflow.core.advance.ParticipantNodeHandler.doTransition(ParticipantNodeHandler.java:236)

        at com.adobe.granite.workflow.core.advance.ParticipantNodeHandler.doTransition(ParticipantNodeHandler.java:134)

        at com.adobe.granite.workflow.core.advance.AdvanceUtil.transitionFrom(AdvanceUtil.java:143)

        at com.adobe.granite.workflow.core.WorkflowSessionImpl.completeInternal(WorkflowSessionImpl.java:1058)

        at com.adobe.granite.workflow.core.WorkflowSessionImpl.complete(WorkflowSessionImpl.java:1032)

        at com.adobe.granite.workflow.core.process.GotoProcess.execute(GotoProcess.java:112)

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:193)

        ... 8 common frames omitted

Caused by: javax.jcr.ItemExistsException: node3_etc_workflow_instances_server0_2018-10-01_1_upload-asset_555

        at org.apache.jackrabbit.oak.jcr.session.NodeImpl$5.perform(NodeImpl.java:287)

        at org.apache.jackrabbit.oak.jcr.session.NodeImpl$5.perform(NodeImpl.java:264)

        at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:208)

        at org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:112)

        at org.apache.jackrabbit.oak.jcr.session.NodeImpl.addNode(NodeImpl.java:264)

        at com.adobe.granite.workflow.core.jcr.WorkItemManager.addWorkItem(WorkItemManager.java:119)

        ... 16 common frames omitted

Replies

Highlighted

Avatar

Avatar

ashishc8696822

Avatar

ashishc8696822

ashishc8696822

15-10-2018

Can you consider enabling audit.log entries to see what's the exact conflict? (note the change of log-level for audit.log to TRACE)

1596826_pastedImage_0.png