Error transferring URL - server replied: Locked

Error transferring URL - server replied: Locked

Nextcloud version (eg, 12.0.2): 15.0.2
Operating system and version (eg, Ubuntu 17.04): CentOS Linux release 7.6.1810
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.6
PHP version (eg, 7.1): PHP/7.2.12

The issue you are facing:

A colleague of mine is uploading a folder to his NC space via the website, which is working fine. After he uploaded the folder, he checks in his macOS client to make sure the sync is working fine. The client however shows a red line with an error message:

Error transferring URL* - server replied: Locked

*I replaced URL with the actuall URL for security reasons

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Upload a folder via the website
  2. Check for sync in the macOS () client
  3. See error message in

The output of your Nextcloud log in Admin > Logging:

Output
[no app in context] Error: OCP\Lock\LockedException: "files/9f025a6cd706036e078cac8d8fb0ed5c" is locked at <<closure>>

 0. /var/www/html/nextcloud/htdocs/lib/private/Files/Storage/Common.php line 778
    changeLock("files/9f025a6cd706036e078cac8d8fb0ed5c", 2)
 1. /var/www/html/nextcloud/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php line 615
    changeLock("files/htdocs", 2, OC\Lock\DBLockingProvider {})
 2. /var/www/html/nextcloud/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php line 615
    changeLock("files/htdocs", 2, OC\Lock\DBLockingProvider {})
 3. /var/www/html/nextcloud/htdocs/lib/private/Files/View.php line 1964
    changeLock("files/htdocs", 2, OC\Lock\DBLockingProvider {})
 4. /var/www/html/nextcloud/htdocs/lib/private/Files/View.php line 1140
    changeLock("/htdocs", 2)
 5. /var/www/html/nextcloud/htdocs/lib/private/Files/View.php line 347
    basicOperation("rmdir", "/htdocs", ["delete"])
 6. /var/www/html/nextcloud/htdocs/apps/dav/lib/Connector/Sabre/Directory.php line 312
    rmdir("/htdocs")
 7. /var/www/html/nextcloud/htdocs/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    delete()
 8. /var/www/html/nextcloud/htdocs/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 287
    delete("files/michael.lingg/htdocs")
 9. <<closure>>
    httpDelete(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
10. /var/www/html/nextcloud/htdocs/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpDelete"], [Sabre\HTTP\Requ ... }])
11. /var/www/html/nextcloud/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit("method:DELETE", [Sabre\HTTP\Requ ... }])
12. /var/www/html/nextcloud/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
13. /var/www/html/nextcloud/htdocs/apps/dav/lib/Server.php line 301
    exec()
14. /var/www/html/nextcloud/htdocs/apps/dav/appinfo/v2/remote.php line 35
    exec()
15. /var/www/html/nextcloud/htdocs/remote.php line 163
    require_once("/var/www/html/n ... p")

DELETE /remote.php/dav/files/user/htdocs
from ***** by user at 2019-01-22 T 08:23:56+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

Output
<?php
$CONFIG = array (
  'instanceid' => '***instance_id***',
  'passwordsalt' => '***salty***',
  'secret' => '***secret***',
  'trusted_domains' =>
  array (
    0 => '***domain1***',
    1 => '***domain2***',
    2 => '***domain3***',
  ),
  'datadirectory' => '/mnt/nextcloud-data',
  'dbtype' => 'mysql',
  'version' => '15.0.2.0',
  'overwrite.cli.url' => 'https://nextcloud.url.com/',
  'proxy' => '***some_proxy***',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => '***db_password****',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => false,
  'log_rotate_size' => 10485760,
  'updater.secret' => '***updater_secret****',
  'theme' => '',
  'loglevel' => 2,
  'lost_password_link' => 'disabled',
  'updater.release.channel' => 'stable',
);

The output of your Apache/nginx/system log in /var/log/____:

Output
[Tue Jan 22 08:15:18.145136 2019] [php7:error] [pid 23081] [client IP] PHP Fatal error:  Uncaught PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105\nStack trace:\n#0 /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(105): PDOStatement->execute(NULL)\n#1 /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1006): Doctrine\\DBAL\\Driver\\PDOStatement->execute()\n#2 /var/www/html/nextcloud/htdocs/lib/private/DB/Connection.php(216): Doctrine\\DBAL\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#3 /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(208): OC\\DB\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#4 /var/www/html/nextcloud/htdocs/lib/private/DB/QueryBuilder/QueryBuilder.php(214): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/www/html/nextcloud/htdocs/lib/private/Lock/ in /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 115



[Tue Jan 22 08:15:18.380741 2019] [php7:error] [pid 15572] [client IP] PHP Fatal error:  Uncaught PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105\nStack trace:\n#0 /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(105): PDOStatement->execute(NULL)\n#1 /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1006): Doctrine\\DBAL\\Driver\\PDOStatement->execute()\n#2 /var/www/html/nextcloud/htdocs/lib/private/DB/Connection.php(216): Doctrine\\DBAL\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#3 /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(208): OC\\DB\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#4 /var/www/html/nextcloud/htdocs/lib/private/DB/QueryBuilder/QueryBuilder.php(214): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/www/html/nextcloud/htdocs/lib/private/Lock/ in /var/www/html/nextcloud/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 115

Another colleague just notified me, that he is getting random locked messages and I can’t seem to find out why that is and why all of a sudden, as this used to work before.

I’m helpful for any information/help I can get.

Hi CFelix

I’m not sure what causes the locks. Normally the client create locks if you are editing a file. normally.
Maybe it could resolve the problem if you empty the oc_file_locks table.

Hi suhype,

since it says Deadlocks, my guess is that Nextcloud is kind of locking the whole table instead of just the row in question. If I drop all the content of the oc_file_locks table, wouldn’t that cause any issues in Nextcloud?

My understanding of that table is; Nextcloud is doing something with some data and locks that data, hence it safes the lock in that table and gives it a certain status.

Now the question would be; Shouldn’t Nextcloud either change the status or remove the row, after it’s done working on that data?

Your absolutely right. My fault, didn’t read it good enough :pleading_face:

Seems its an issue on NC (see this post).
and that it should be fixed due to this github discussion.
But anyway maybe you can find some helpfull infos in the github discussion.