Files locks not releasing

Nextcloud version: 18.02
Operating system and version: SME Server 9.02
Apache or nginx version: Apache/2.2.15
PHP version: 7.3

The issue you are facing:

File locks do not appear to be releasing. Several files have multiple locks on them, as many as 9 or 10 according to the oc_file_locks table. We have a process that creates files which are then synched with NextCloud so others can use them. These are library files for an application called Omnis; in short, they are pieces used to build an application. Because of the file locks, the NextCloud files are not getting automatically updated the way they should be.

Is this the first time you’ve seen this error?

Yes and No. We had this problem under NC 16, but we disabled filelocking. We recently re-enabled filelocking under 18.03 (and after that updated to 18.04). Everything worked at first, but on 5/15 the file locking started preventing our builds from updating.

Steps to replicate it:

  1. Our build process runs, creates several files
  2. Those files are placed in a directory which synchs with NextCloud
  3. Synch fails for some of the files. In the NextCloud client, under Activity, we get a message: Server replied “423 Locked” to “PUT URI/filename”

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!): (Some lines are removed as they are “identifiable information”)

$CONFIG = array (
  'datadirectory' => '/home/e-smith/files/ibays/nextcloud/html/data',
  'dbtype' => 'pgsql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbtableprefix' => 'oc_',
  'installed' => true,
  'filelocking.enabled' => true,
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  '' => 'stable',

The output of your Apache/nginx/system log in /var/log/____:
Nothing related to this problem is in the log file. The problem occurred this morning, and the last entry in the system log file is from several hours before the failure.

Can you install a redis cache? This handles file locks much faster and there are less problems reported.

I have now installed Redis and configured for it. I will let you know if this helps. :slight_smile:

Redis does not seem to be helping. I am not confident it is properly configured. When I have this line in my NextCloud config.php, NC fails with a 500 Internal Server Error:

'memcache.distributed' => '\\OC\\Memcache\\Redis',

I have not yet been able to ascertain what the server error is, exactly. I have not found an error in the log file where this usually shows up, and I have checked other logs with no success. The rest of my config related to Redis is:

'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0,
    'dbindex' => 0,

Any help would be appreciated.