Next cloud Server and Desktop some file not sync

Dear Sir

I try to check the server and desktop number of files. desktop ver not sync with the server.
I check the log in my desktop folder. this file “Destination file exists” I think the endures move the file from AAA to BBB folder.
today i run many time occ files:scan with this path. but still not sync. how to fix this issue and prevent this issue again?

Server is Nextcloud 12
And the desktop ver 2.3.3-1

Server Side

AAA Internal Working Folder/AAA/ (No LM.docx)
AAA Internal Working Folder/BBB/LM.docx

Desktop side ### this two file include same file.

AAA Internal Working Folder/AAA/LM.docx
AAA Internal Working Folder/BBB/LM.docx

||AAA Internal Working Folder/AAA/LM.docx -> AAA Internal Working Folder/BBB/LM.docx|INST_RENAME|Down|1518488991|b5e624cad46b82772bbeb4d56dc1644e|22082|00095024octolgk5wat4|2|Destination file exists|0|0|0|||INST_NONE|

Hi green_mon

I’ve got the same issue again and again, no matter which NC Version. I found no long term solution so far. In my case i always had file locking issues. So as NC recommends i did set up a redis cache server. Check this:

Unfortunately I still got sync issues from time to time. My manual workaround at the moment is:

  1. occ ‘files:scan --all’
  2. occ ‘files:cleanup’
  3. if already solved stopp where, if not proceed with step 4
  4. occ ‘maintenance:mode --on’
  5. sign in to your mysql or maria db and run: “delete from oc_file_locks where 1;”
  6. occ ‘maintenance:mode --off’

Good luck, Cheers zisuu

Dear Zisuu

Think you, I will try to ‘files:scan --all’ and ‘files:cleanup’.
For your step 5, this mean if the we need delete all the records in table “oc_file_locks”

Yes run: “delete from oc_file_locks where 1;”

You can read more about it here: File is locked - how to unlock

If you use redis, oc_file_locks should not be used at all. So if you have to delete entries in this table, there is probably something wrong.

1 Like

Thanks a lot tflidd for your hint.

Found out that I still have installed and used APCu inside my docker containers. Is that a problem? To me it looks, like my redis cache does work. When I run “redis-cli MONITOR” and browse around on NC webinterface, I get a lot of output.

Can you maybe help me, to verify my redis setup?
Nextcloud configuration:
Version: 13.0.0
PHP Version: 7.0

$CONFIG = array (
  'instanceid' => 'doesnotmatter',
  'passwordsalt' => 'doesnotmatter',
  'secret' => 'doesnotmatter',
  'trusted_domains' => 
  array (
    0 => 'mydomain',
  'datadirectory' => '/var/www/owncloud/data',
  'overwrite.cli.url' => 'https://mydomain',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'ocdb',
  'dbhost' => 'xx.xx.xx.xx',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'doesnotmatter',
  'dbpassword' => 'doesnotmatter',
  'logtimezone' => 'Europe/Zurich',
  'installed' => true,
  'updatechecker' => 'false',
  'ldapIgnoreNamingRules' => false,
  'maintenance' => false,
  'default_language' => 'en',
  'theme' => '',
  'loglevel' => 2,
  'singleuser' => false,
  'htaccess.RewriteBase' => '/',
  'log_rotate_size' => '104857600',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\OC\Memcache\APCu',
  'redis' => 
  array (
    'host' => 'redis',
    'port' => 6379,

Redis configuration:
Official Redis Alpine docker image with redis version: 3.2.8. No custom config made, I just run the default image with: redis-server --appendonly yes

Thanks a lot! Cheers zisuu

The locking cache is important to set to Redis, that looks good. It’s even recommended to keep APCu as local memcache. I would perhaps uncomment the distributed cache and then monitor redis. This way you know if there is some activity on redis due to the filelocking. If it fails or doesn’t work, it normally should show up in your logs.
I run Nextcloud in a Linux machine so I can use sockets to connect. With ports, it can be a bit trickier, if they ask for an authentication (not sure if that is imposed by default).

1 Like


We have redis working (I believe)

I can see activity when browsing my nextcloud while running sudo -u redis redis-cli MONITOR

1519137178.519266 [0] "INCRBY" "babbdf817418f394115dcb451bcd1118/lockfiles/463994be56845c1ba10b41c8ecf42b07" "1"
1519137178.519573 [0] "EXPIRE" "babbdf817418f394115dcb451bcd1118/lockfiles/463994be56845c1ba10b41c8ecf42b07" "3600"
1519137178.519768 [0] "INCRBY" "babbdf817418f394115dcb451bcd1118/lockfiles/9ff1bbb409309d88a84a353fc42f66d7" "1"
1519137178.519914 [0] "EXPIRE" "babbdf817418f394115dcb451bcd1118/lockfiles/9ff1bbb409309d88a84a353fc42f66d7" "3600"
1519137178.520100 [0] "INCRBY" "babbdf817418f394115dcb451bcd1118/lockfiles/f710c0d8c48ae0eeca9bcca46be1b237" "1"
1519137178.520236 [0] "EXPIRE" "babbdf817418f394115dcb451bcd1118/lockfiles/f710c0d8c48ae0eeca9bcca46be1b237" "3600"
1519137178.520440 [0] "WATCH" "babbdf817418f394115dcb451bcd1118/lockfiles/463994be56845c1ba10b41c8ecf42b07"
1519137178.520622 [0] "GET" "babbdf817418f394115dcb451bcd1118/lockfiles/463994be56845c1ba10b41c8ecf42b07"

My config.php is like this

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,

There don’t seem to be any locked files, right?

(Is there a way to know what files are referenced by these keys?)

select * from oc_file_locks;
| id | lock | key                                    | ttl        |
|  6 |    0 | files/9ff1bbb409309d88a84a353fc42f66d7 | 1511869459 |
|  9 |    0 | files/f710c0d8c48ae0eeca9bcca46be1b237 | 1511869459 |
| 12 |    0 | files/10366d5ca576dfc4af650a2def84080b | 1511868858 |
| 13 |    0 | files/e409949c638dce9e88c22ff53feea43e | 1511868858 |
| 25 |    0 | files/463994be56845c1ba10b41c8ecf42b07 | 1511869459 |

But.… we cannot edit, delete or sync some files.
Log shows

Fatal webdav OCA\DAV\Connector\Sabre\Exception\FileLocked

We think this is happening to files edited by Collabora.
Any thoughts please?


Sorry for hijacking the thread :zipper_mouth_face:
Solved this by flushing the redis cache sudo -u redis redis-cli flushall

If collabora creates these issues, this should be reported to the bugtracker. The cache should manage itself and cronjobs should flush old lockings without user interaction.