File corruption with NextCloud Desktop

Nextcloud version (eg, 20.0.5): 22.2.3
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20 inside Proxmox container
Apache or nginx version (eg, Apache 2.4.25): Nginx reverse proxy into Apache2

The issue you are facing:

It seems that rapidly changing files confuse the sync mechanism resulting in corrupt files.

For example I am using Nextcloud Desktop to sync my “Documents” folder on my Windows machine. If I use Visual Studio Code to edit a file, and if VS Code is set to autosave then randomly the file becomes corrupt or sync conflicts occur randomly.

By “corrupt” I mean the end of the file is often lost or replaced with “nul” for approximately the same number of characters as was added to the file.

This feels like a race condition or something where new changes are being synced while older changes are also being synced or haven’t yet finished uploading.

Visual Studio Code’s autosave is pretty agressive, it saves after every character as you type. If I disable autosave in VS Code the files sync correctly.

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

Steps to replicate it:

  1. Set up Nextcloud to sync a folder
  2. Open Visual Studio Code
  3. Set visual studio code to autosave
  4. Edit files by typing in new content
  5. Eventually you will notice the end of the file becomes corrupt