Thread safety of variables and queues etc when using ASync groups

Where can I find details of what is safe to use when running multiple threads in ASync groups?   As a developer I appreciate the issues of multi-threaded access, but I cannot find anywhere in the help that gives specifics for FB/AT features. The help just appears to mention items to be aware of in rather general terms and there are a few issues mentioned for certain actions.

For example key questions:

  • Is reading and writing from global variables atomic for any or all types? If so is this also the case for access from action or global scripts?  Given the 'Wait for Variable' action I am guessing variable updates are atomic but I would like to have that confirmed.
  • Is a single stack/queue safe to use from mutliple ASync threads. For example when multiple threads are processing a global list of tasks and some tasks take longer than others, hence each thread needs to take the next item from the shared list and process it until the list empty.

I could use the Mutex/Lock File action to add action level locking around items that are not inherently safe but would rather not have to use that in lots of places if not necessary.

Apologies in advance if I've missed some specific topic in the help ;-) 

Hi Simon

Reading and writing variables is thread safe, we lock around reading and writing. The same applies to stack/queues… one of the stress test projects I use here has a lot of threads processing a very deep queue… it’s a good test of scalability because it touches a lot of the core stepping engine, the logging engine etc.

Having said that, we did fix a bug recently to do with deadlocking on a queue, that fix is in the most recent FinalBuilder update (last week) but we haven’t gotten around to releasing an Automise 4 update yet, I’ll try to get that done tomorrow (I was waiting on feedback on another bugfix).

Hi Vincent,

Thanks for the prompt reply. We use both Automise and FinalBuilder but the task that made me post this question is for an Automise script used in our IT systems so we’ll wait for the update.

Simon

Hi Simon

The Automise update is on the website now (4.0.0.196).

Does this statement apply to all products, such as the FinalBuilder?

With AppendToVariable in an AsyncActionGroup, I noticed several times last year that some content was missing.

Most operations with variables are thread safe, however Append to Variable is not. I have no idea why but the dev who wrote it chose to write it using action studio - so there was no way to invoke the locking around reading/writing the variable.

We will re-implement this action in native code for FB9 - that way we can ensure it’s thread safe.