Skip to content

Folder Lock Timeouts ​

File and folder operations lock the affected folders while they change the file system, for example uploading, saving, renaming, moving or deleting files and folders. Locks are lock files on the shared data volume, so they also work across several instances (pods) of a cluster installation.

An operation that needs a folder locked by another operation waits for it. These waits are limited per folder lock: when the limit is reached for one lock, the operation fails and is rolled back, and a request of the DAM API (/api/extensions/dam/…) answers with HTTP 423 Locked. This keeps a long running or stuck operation from blocking request threads and database connections of the whole instance.

Settings ​

All settings are durations (e.g. 500ms, 5s, 10m, 1h) and can be set as property or environment variable.

PropertyEnvironment variableDefaultDescription
fourallportal.dam.sync-lock-wait-timeoutFOURALLPORTAL_DAM_SYNC_LOCK_WAIT_TIMEOUT5sMax wait for a folder lock of operations that run directly within a request, e.g. uploads, saving, renaming or deleting single files and folders. 0 waits without limit (not recommended).
fourallportal.dam.lock-wait-timeoutFOURALLPORTAL_DAM_LOCK_WAIT_TIMEOUT10mMax wait for a folder lock of operations that run as a separate task, e.g. bulk deletes or moves. 0 waits without limit.
fourallportal.dam.lock-file-timeoutFOURALLPORTAL_DAM_LOCK_FILE_TIMEOUT1mTime after which a lock file that its holder no longer keeps alive, e.g. after an instance was terminated, is treated as stale and released. Minimum 30s.
fourallportal.dam.max-execution-timeFOURALLPORTAL_DAM_MAX_EXECUTION_TIME1hMax execution time of an operation that runs as a separate task. The operation is not interrupted: if it finishes after this time, it is reported as failed and its file system changes are rolled back, while its database changes are kept. 0 runs without limit.

Invalid values, e.g. negative durations or a lock file timeout below 30s, are ignored with a WARN entry of DamProperties at startup, and the default is used.

Within one instance, operations waiting for the same folder get it in the order they arrived. After several handovers within one instance, it pauses briefly, so other instances also get a chance to take a heavily used folder.

The defaults fit most installations. The following profiles are starting points for systems with a clearly higher or lower load. Check them on the actual system before using them in production.

SettingDefaultHigh loadLow load
sync-lock-wait-timeout5s5s, up to 8s if many uploads go into the same folder at the same time10s
lock-wait-timeout10m5m10m
lock-file-timeout1m90s30s

High load: several instances, a network file system (NFS, S3 Files), many concurrent uploads, integrations that retry failed requests.

  • Keep sync-lock-wait-timeout short. While a request waits for a folder lock, it keeps its request thread and a database connection. A longer wait lets these pile up when many requests wait at the same time.
  • A shorter lock-wait-timeout frees request threads of bulk operations earlier.
  • A longer lock-file-timeout avoids that a lock of a living instance is treated as stale, e.g. due to attribute caching or slow metadata updates of the network file system under load.

Low load: a single instance, a local volume, few concurrent users.

  • A longer sync-lock-wait-timeout results in fewer 423 responses, because the database connections are not at risk.
  • A short lock-file-timeout releases lock files left behind by a terminated instance earlier.

Choosing Your Own Values ​

  • sync-lock-wait-timeout plus the database connection timeout must be clearly below the timeout of clients and load balancers. Otherwise clients cancel and retry requests that still wait, and the load increases further. The limit applies to each folder lock: an operation that locks several folders one after another, e.g. moving a folder, can wait a multiple of it. Plan the client timeout for the operations that lock the most folders.
  • lock-file-timeout should be at least three times the longest expected delay of a modification time on the data volume: attribute caching of the file system, clock skew between instances and pauses of an instance.
  • On a network file system, check the attribute cache of the mount (actimeo, acregmax). If it is longer than 30s, increase lock-file-timeout accordingly.
  • Many concurrent writes into the same folder are limited by the folder lock, not by the settings. More instances or distributing the writes over several folders help more than longer waits.
  • Keep max-execution-time above the longest expected operation, e.g. deleting or moving a large folder tree on a network file system. It does not stop an operation; an operation that finishes later keeps its database changes, but its file system changes are rolled back.

WARNING

0 (without limit) for sync-lock-wait-timeout or lock-wait-timeout lets requests wait as long as the lock is held. A single stuck operation can then use up all request threads and database connections of an instance.

Troubleshooting ​

ObservationMeaning
HTTP 423 Locked with type /problems/dam/folder-locked from the DAM APIThe operation did not get the folder lock within the wait limit. Retry the request later.
WARN entry Lock wait of PT5S expired: <lock file> of FileSystemTransactionA wait reached its limit. Frequent entries for the same lock file point to a long running operation on this folder or to many concurrent writes into it.
WARN entry Invalid <setting> <value>, using <default> of DamPropertiesA configured value is invalid, the default is used.
Request missing documentation