- Docs
- Automations
- Troubleshooting Automations
- Race Conditions with Automations
Race Conditions with Automations
Race conditions happen when multiple things interact with the same files or folders at the same time.
On Files.com, this can occur when multiple Automations are all set up to act on the same source or destination location. It can also occur when Remote Syncs or Remote Mounts target the same source or destination location being used by an Automation.
Because these operations may happen simultaneously, or run at overlapping times, it's not possible to predict which one will run first or finish first. This can lead to unexpected results, such as missing files, failed transfers, or partial operations.
Do not configure multiple workflows that use the same location unless you're sure they won't interfere with one another. This includes using the same folder or mount path in more than one Automation, Sync, or Mount-related process. These overlaps can cause problems that are difficult to trace and troubleshoot.
For example, if an Automation and a Remote Server Sync both try to act on the same files at the same time then there's a chance one of them will fail. This is especially true if one is set to delete or move those files after copying. One might try to copy a file that has already been deleted, or two jobs might try to delete the same file, which can result in unpredictable behavior or log errors.
The risk of race conditions increases when using Remote Server Mounts as a source or destination. Files from mounted remote systems may still be in use or actively changing if they're being written to by another system or user. If an Automation runs on a file that hasn't finished uploading or is still open on the remote server, it could result in incomplete copies, failed moves, or file corruption.
Race conditions aren't always obvious. Sometimes they show up in logs as errors like "not found" or "destination already exists," and other times they might cause a job to skip files without any visible warning.
Avoiding These Issues
Designing your workflows to avoid overlap is the best way to make sure your files are handled reliably and safely.
Do not set up multiple Automations to use the same folder.
Do not use the same folder in both an Automation and a Sync, especially if either one deletes or moves files.
Whenever possible, combine actions into a single Automation or Sync to ensure everything happens in a predictable order.
Use unique Include and Exclude pattern matching in each Automation to ensure that targets for each Automation do not overlap.