Estimated time to read: 3 minutes
TL;DR: Apparently, automation branches can exceed memory / resource limits and fail to process completely. Please read further to learn a workaround.
What is the problem?
Every week or so, I review the new automation-related suggestions / defects in the public backlog to catch up on evolving changes. That is when I read this curious one:
Automation logging is not showing "Branch execution chunk" error
https://jira.atlassian.com/browse/AUTO-1885
It appears there is a cumulative memory limit for items processed during branching. That limit is not described in the service limits or in the branching documentation, yet it seems implied by the information about processing larger blocks of work items:
What is an example of this?
The specific scenario is using an action such as Lookup Work Items, and it loads around 100 items which have a substantial amount of associated data. That lookup result is provided to the branch (and other following rule steps). Branches on more-than-one-thing are processed in parallel and asynchronously...leading to the memory / resource load happening mostly at once.
For example:
- trigger: some rule trigger
- action: Lookup Work Items, with JQL that returns 100 items (or more)
- branch: some branch over lots of things (e.g., JQL, advanced on smart values, etc.)
- action: do something...with full access to the {{lookupIssues}} results
The resulting symptom may be the branch halts at a certain point through the items, throwing an error in the audit log.
What is the workaround / mitigation?
Depending upon your scenario, there are a couple of workaround variations. The idea is to save the data needed, such as with Create Variable, and then "throw away" the lookup results by performing another lookup. The second lookup will free the memory / resources and prevent the problem in the branch.
- trigger: some rule trigger
- action: Lookup Work Items, with JQL that returns 100 items (or more)
- action: Create Variable
- variable name: varSomeData
- smart value: some subset of the data from {{lookupIssues}}
- action: Lookup Work Items, with JQL that returns 0 items, such as
- project=ABC AND key=ABC-123 AND key!=ABC-123
- branch: some branch over lots of things (e.g., JQL, advanced on smart values, etc.)
- action: do something, using {{varSomeData}} when needed
I hope this short article helps you resolve / prevent this symptom. Please let me know your feedback and if you have observed this one in your automation rules.
Happy rule writing!