Parallel for each Issue

Hi ,

I’m trying to process pdf files using IXP and I 'm using parallel for each to create validation task and wait for validation task. I see the job getting faulted after creating validation task with below error. It worked before for 3 or 4 files when there are 10 files it struggles.Is there a way to handle this

System.InvalidOperationException: The activity ‘Create Validation Task’ with ID 113 threw or propagated an exception while being canceled. —> System.AggregateException: One or more errors occurred. (A task was canceled.) —> System.Threading.Tasks.TaskCanceledException: A task was canceled. at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)

Hello @phoenixacademy,

Limit parallelism: Set MaxDegreeOfParallelism to 2–4 instead of letting all run at once.

Add retry: Wrap Create Validation Task in a Retry Scope to handle temporary failures.

Use Try Catch: Catch exceptions like TaskCanceledException to log and continue.

Optional: Increase activity timeout or process files sequentially for very large batches.

May I know how do we set MaxDegreeOfParallelism for parallel for each?

Steps:

  1. Select your ‘Parallel For Each’ activity in the workflow.
  2. In the ‘Properties’ panel (usually on the right side):
  • Look for ‘MaxDegreeOfParallelism’.
  1. Set it to a number, e.g., 3 or 4.
  • This means only 3–4 iterations will run at the same time, even if your collection has 10+ items.
  1. Save and run your workflow.

@sagar.singh1

Thats ok if you use llm to get your answer but try to validate it before you post so that no wrong or improper info is posted.

@phoenixacademy

Can you open the debug panel and look for exception details there it would provide the full trace to understand the issue

Generally upto 50 documents or so it should not be throwing any error..it is already observed when request gets more orchestrator rejects them automatically..

I dont thinkt he current error is due to the number of calls but may be due to your license..if not if less than 5 is working then you need to chunk the data or list before hand and loop through each set separately..isntead of all at once..enumerable.chunk or .take and .skip can be used for chunking the data

Cheers