- Docs
- Integrations
- Remote Servers
- Remote Server Sync (Legacy)
- Troubleshooting Remote Server Sync
- Race Conditions with Sync
Race Conditions with Sync
Race conditions can happen when multiple things try to interact with the same files or folders at the same time.
On Files.com, this can occur when multiple Syncs are all set up to act on the same source or destination location. It can also occur when Automations or Remote Mounts target the same source or destination location being used by a Sync.
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.
Files on remote servers may be in use by another user or process on that system. Syncing files while they are in use on the remote server causes 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.
Designing your workflows to avoid overlap is the best way to make sure your files are handled reliably and safely.
Avoiding Race Conditions with Sync
Do not set up multiple Syncs 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 Sync or Automation to ensure everything happens in a predictable order.
Use unique Include and Exclude pattern matching in each Sync to ensure that targets for each Sync do not overlap.