Stop ownCloud File Lock Timeouts with the Right Backend

When ownCloud reports a file-locking timeout, do not immediately delete database lock rows or disable locking. First determine whether the message refers to transactional locking during a file operation or a user-created WebDAV lock with an expiration time. For recurring transactional-locking timeouts, moving the lock cache from the database to Redis is usually the practical fix for busy servers; low-traffic installations may keep the database backend if it is healthy.

Identify which lock is timing out

Transactional file locking protects files while ownCloud processes uploads, syncs, moves, and other changes. It is enabled by default and stores locks in the database unless a locking cache is configured. A slow or overloaded database can therefore make file operations wait. ownCloud’s Server 10.16 guidance recommends Redis for external transactional locking to reduce database load.

Manual file locking is different: a user deliberately locks a file to prevent other users from changing it, and the WebDAV Locks feature applies an expiration time. In ownCloud Server 10.16, an administrator can set the default and maximum timeout and define lock-breaker groups. Action: use the log message, affected files, and whether a user sees a lock indicator to identify the mechanism before applying a fix.

A message such as MySQL “Lock wait timeout exceeded” can indicate a database transaction waiting on another transaction, rather than an expired user lock. Likewise, “Redis went away” points to Redis connectivity, not a stale file. Action: inspect the ownCloud log and database/Redis logs at the same timestamp; do not treat every “lock” error as the same problem.

Choose the backend that fits the server

SituationPractical choiceTrade-off
Private, low-traffic home serverKeep database locking while investigating database healthFewer services to manage, but lock activity adds database work.
Busy single serverConfigure Redis for locking; use APCu for local cache if availableReduces locking load on the database, but Redis and its PHP extension must stay available.
Multiple application serversUse a shared Redis endpoint reachable by every web nodeSupports a common lock cache; Redis network access, authentication, and availability become operational dependencies.

ownCloud documents that Memcached does not provide the durable lock behavior needed for transactional file locking, so do not set memcache.locking to Memcached. Redis is the supported choice for this role. Action: if you already use Memcached for distributed caching, keep that function separate and configure Redis specifically for locks.

Check Redis before changing ownCloud

Confirm Redis is installed, running, reachable from the PHP web workers, and protected according to your network design. The PHP Redis extension must also be available to the web runtime; checking the command-line PHP alone may not prove Apache or PHP-FPM uses the same extension. For a local Redis instance, ownCloud’s documentation supports either TCP or a Unix socket. In a cluster, all application nodes must point to the same Redis locking service, not separate local Redis databases.

Before editing, back up config/config.php and note any existing local or distributed cache settings. Do not flush the entire Redis database as a routine first step: it can erase unrelated cached data or sessions depending on how Redis is shared. Action: identify the Redis database index and whether other applications use that Redis instance before maintenance.

Configure transactional locking with Redis

Add or merge the following entries into config/config.php. Do not create duplicate PHP array keys; update existing entries instead. This example uses Redis over TCP on the same host:

'filelocking.enabled' => true,
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
    'host' => '127.0.0.1',
    'port' => 6379,
    'timeout' => 0,
    'password' => 'replace-with-your-redis-secret',
    'dbindex' => 0,
],

Use the Redis host, port, password, database index, and socket path that match your deployment. Restrict Redis to trusted local or private network clients, and do not expose it publicly. For a Unix socket, ownCloud’s example uses the socket path as host and sets port to 0. The web server user must have permission to access that socket.

Restart or reload the relevant PHP/web services only if required by your installation’s configuration process. Then check the Admin overview and ownCloud log for cache or locking exceptions. Action: test a small upload, rename, and sync operation with a test account before considering the change complete.

When the problem is a manual lock timeout

If a user-created lock is lasting too long, review the Manual File Locking settings under Settings > Admin > General. ownCloud 10.16 documents these occ examples for setting the default and maximum WebDAV lock lifetimes:

sudo -u www-data ./occ config:app:set files lock_timeout_default --value 1800
sudo -u www-data ./occ config:app:set files lock_timeout_max --value 86400

These values are in seconds. The defaults in the example are not mandatory for every policy; choose a duration that matches how long users reasonably need to hold a lock. For a genuinely abandoned lock, the lock owner may be able to unlock it from the file details view. An administrator can also configure a lock-breaker group. Action: prefer the supported UI/API or group-based recovery path rather than editing WebDAV lock records directly.

Verify the fix and avoid risky shortcuts

After the change, verify that uploads and sync operations complete, that simultaneous edits do not cause file corruption, and that the logs no longer show recurring lock-backend timeouts. If the log now reports Redis connection failures, fix Redis availability, credentials, extension loading, or socket permissions; switching back and forth without understanding the failure can hide the original cause.

Do not disable transactional locking to make timeouts disappear. It protects file operations, and removing it can create integrity problems under concurrent activity. Do not delete database rows from the lock tables or flush a shared Redis database unless ownCloud support documentation for the exact failure directs you to do so. Action: if the issue persists after confirming the configured backend and its health, capture the timestamped ownCloud and backend logs and investigate the slow database queries or lock contention with your administrator.

Official references

Leave a Comment

Stop ownCloud File Lock Timeouts with the Right Backend

Distinguish database lock contention from expired WebDAV locks, then choose and configure the right ownCloud 10 fix.

What to Check When ownCloud Web Opens to a Blank Page

What to Check When ownCloud Web Opens to a Blank Page

Trace a blank ownCloud Web screen to browser cache, missing web assets, service errors, or reverse-proxy URL settings with targeted checks.

Clear the ownCloud PHP Memory Warning in the Correct Runtime

Set ownCloud’s web PHP memory limit, restart the matching service, and verify the active value without confusing it with CLI settings or upload limits.

Troubleshoot ownCloud 10 MySQL Connection Failures

Find out whether MySQL, PHP, socket settings, or database permissions are blocking ownCloud 10, then verify a safe fix.

Set a Firm Expiration Limit for ownCloud Public Links

Set a Firm Expiration Limit for ownCloud Public Links

Make public link expiration mandatory in ownCloud Classic, set a maximum lifetime, and check existing shares that may need separate cleanup.

Add TOTP Two-Factor Login to ownCloud Infinite Scale with Keycloak

Add TOTP Two-Factor Login to ownCloud Infinite Scale with Keycloak

Enable TOTP through Keycloak, enroll users safely, and understand when Infinite Scale’s route-level MFA settings apply.

Restore ownCloud Sync by Matching the Client to Your Server

Check whether the issue is an OC10 and 7.x compatibility break or a damaged CSync journal, then apply the right fix without deleting synced files.

Put ownCloud on HTTPS with Let’s Encrypt and Nginx

Put ownCloud on HTTPS with Let’s Encrypt and Nginx

Choose HTTP-01 or DNS-01, configure an ownCloud reverse proxy, and verify Certbot renews HTTPS certificates automatically.

Connect ownCloud Infinite Scale to LDAP for User Sign-In

Configure oCIS LDAP sign-in, align user and group lookups, and verify TLS and schema settings before rollout.

Connect an S3 Bucket to ownCloud 10 as External Storage

Connect an S3 Bucket to ownCloud 10 as External Storage

Add an Amazon S3 bucket to ownCloud 10, prepare compatible credentials and endpoints, and check access without confusing a mount with primary storage.