Skip to main content
mislavu0001
February 7, 2025
Solved

Race condition while appending to process variable array?

  • February 7, 2025
  • 3 replies
  • 0 views

Hi all,
I have a doubt is there a possibility we could have a race condition problem when appending from parallel process nodes to the same pv array?

I have a following situation:

So, I am generating several documents in parallel. Some of them will be generated, some of them will be skipped (based on ContractX gateways decision). When generated, I would like to add them as a document cdt instance to the array of document cdts stored in a process variable.

So in each yellow marked script task I am using (on output tab) :


I usually didn't have problems with possible race condition. But, in theory, is this 100% safe method?

Is there a possibility multiple 'Add to docs array' nodes are executed on different process engines and execution happens exectly at the same time and there is a possibility of data loss (some items are not added to the array because 2 engines had different state of the array)?

I know there is a workaround where we can merge all parts of the array after AND joining node...


Best answer by peter.lewis

Yeah I wouldn't expect any issues with running append operations on PVs in parallel paths. Even thought they may both be executing in parallel, they still would save their results to the variable in sequence.

3 replies

stefanhelzle0001
February 7, 2025

Process execution engines run the full process. Individual nodes are not distributed.

[mention:6b9f80ff18f9420082d13ef2d5121d56:e9ed411860ed4f2ba0265705b8793d05] , can you help us with some insights? I would expect that parallel append operations on a PV should be OK.

peter.lewis
Employee
February 7, 2025

Yeah I wouldn't expect any issues with running append operations on PVs in parallel paths. Even thought they may both be executing in parallel, they still would save their results to the variable in sequence.

stefanhelzle0001
February 7, 2025

Thank you for making this clear :-)