Skip to main content

Troubleshooting Workflow Executions: Understanding Race Conditions

A Race Condition occurs when two or more updates happen simultaneously within the same second. These updates "race" against each other, potentially leading to them executing in an unintended order, or one might appear to execute without actually doing so.

Example Race Condition: Add Tag Executed But Not Added

In this scenario, you might notice that a tag appears to be successfully added to a contact in the workflow execution logs. However, upon checking the contact record, the tag is missing.

Identifying the Issue

  • Review the execution log closely, paying particular attention to the timestamps.
  • If the "Add to workflow" and "Add Tag" actions occur at the same exact second, a race condition is likely the cause.

How to Prevent a Race Condition

To resolve this issue, introduce a Wait action in your workflow:

  1. Add a Wait action set to 1 minute between the conflicting actions.
  2. This delay ensures that the actions do not execute simultaneously, eliminating the possibility of a race condition.

For a visual guide on implementing this solution, you can watch this Loom video.

By following these steps, you can ensure your workflows run smoothly without interference from race conditions.