Auto sync is not working properly on Windows 10 client for Group folders and a shared folders, only Force sync now helps

Hello.

Summary:

  • I have a problem with automatic synchronization on Windows desktop clients
  • Auto sync doesn’t work for Group folders at all: none of the users automatically receive changes to files made by another user, only Force sync now helps
  • For shared folders only creator (author) of a shared folder automatically receives changes to files made by other user
  • User of a shared folder has to click Force sync now to get changes made by the creator (author)

What I’m doing wrong?

Versions:

  • Nextcloud Server 16.0.4 on Ubuntu 18.04 LTS
  • Nextcloud Windows Desktop Client version 2.5.3 daily-Win64 (build 20190725) on Windows 10 LTSB 1607
  • Only Group folders app installed additionally

Click below to open a detailed version:

TL;DR version

Thank you for the opportunity to use such a great private cloud software!
I have a Nextcloud server and two Windows clients and automatic synchronization is not working properly. Despite that Force sync now always works properly on both clients.
There are four scenarios, from which only one works as expected.

Configuration:

There are two Nextcloud users that work via Nextcloud Windows Desktop clients on two Windows 10 computers:

  • User1 (admin) on Computer1
  • User2 on Computer2

User1 created:

  • Group folder test-group with read/write access to a group of users User1 and User2
  • A plain folder called test-share and shared it with User2

So User1 sees (had to manually include group folder into sync during initial startup):

  • test-group - a group folder
  • test-share - a folder which is shared

Users 2 sees (had to manually include group folder into sync during initial startup):

  • test-group - a group folder
  • shares/test-share - a shared folder

Before test both users have green icons, so status is all synchronized on both computers.

Scenario 1 (auto sync doesn’t work):

  • User1 (an author of a share) created file 1.txt in test-share (a shared folder)
  • 1.txt file has synced to server almost instantly (sync process is visible in Windows client on Computer1 and file is seen on Nextcloud web site via browser)
  • User2 has not received 1.txt automatically. Folder test-share on Computer2 is empty!
  • User2 has to press Force sync now for 1.txt to sync!

Scenario 2 (auto sync works as expected!!!):

  • User2 (a user of a share) created file 2.txt in test-share
  • 2.txt file has synced to server almost instantly (sync process is visible in Windows client on Computer2 and file is seen on Nextcloud web site via browser)
  • User1 has also almost instantly received file 2.txt during automatic sync. Folder test-share on Computer1 contains file 2.txt without a need to “Force sync now”!

Scenario 3 (auto sync doesn’t work):

  • User1 created file 3.txt in test-group (a group folder)
  • 3.txt file has synced to server almost instantly
  • User2 has not received 3.txt automatically. Folder test-group on Computer2 is empty!
  • User2 has to press Force sync now for 3.txt to sync!

Scenario 3 (auto sync doesn’t work):

  • User2 created file 4.txt in test-group (a group folder)
  • 3.txt file has synced to server almost instantly
  • User1 has not received 4.txt automatically. Folder test-group on Computer1 is empty!
  • User1 has to press Force sync now for 4.txt to sync!

I see something like the following in longs on Windows clients (press F12) like every few seconds (real URLS and user names replaced):

[OCC::RequestEtagJob::finished 	Request Etag of QUrl("https://{server-URL}/remote.php/dav/files/user/") FINISHED WITH STATUS "OK"
[OCC::Folder::slotRunEtagJob 	Trying to check "https://{server-URL}/remote.php/dav/files/user/" for changes via ETag check. (time since last sync: 2819 s)
[OCC::AccessManager::createRequest 	6 "PROPFIND" "https://{server-URL}/remote.php/dav/files/user/" has X-Request-ID "f42adbe3-ade3-521s-a24d-13da43114a14"
[OCC::AbstractNetworkJob::start 	OCC::RequestEtagJob created for "https://{server-URL}" + "/" "OCC::Folder"
[OCC::WebFlowCredentials::slotFinished 	request finished

So it seems Windows client is asking for a changes every few seconds and changes are not correctly reported by server.

Okay, I found a workaround for Group folders and Shared folders to be updated automatically on Windows client. Anyone, who is hot happy with Group folders not synced automatically, can force a periodic automatic sync. Here is how:

  1. Make sure you stopped nextcloud.exe (CTRL+SHIFT+Esc to open Task Manager go to Details tab and search for nextcloud.exe and press “End Task” button and “End process”.

  2. Open %appdata%\Nextcloud\nextcloud.cfg in your text editor.

  3. Add the following section somewhere after [General] section:

    [Nextcloud]
    forceSyncInterval=60000

According to this the above parameter forceSyncInterval is “the duration of no activity after which a synchronization run shall be triggered automatically.” . It is in milliseconds. The default value is 7200000, which is 2 hours. So 60000 gives us 1 minute (use 1 minute only to test it).
4. Save file and run nextcloud.
5. Press F12 to see the log file.
6. Open Group folder on some other computer and create or change a file.
7. Wait for 1 minute to see that all your Group folders were synced automatically.
8. Go back and decide on which time internal is best works for your case of Group folder usage.

Still need to figure out why shared folders is not synchronized based on both users changes.

2 Likes

Same problem here. Is here any better solution than forcing sync every minute?

You can force sync every 5 minutes or so. I realize that the best way would be to trigger sync based on changed that are anyway tracked by Nextcloud every 5 seconds, but it is simply not working that way in Nextcloud Windows client now and we need some workaround while it is not yet ready.

I personally set force sync to every 5 minutes, but my nextcloud storage is really tiny as I use it to sync keeypass storage over to all my devices as well as to be able to exchange with some files back and forth, so synchronization every 5 minutes works pretty well for me.

Please let me know if you find any better way for this. Thanks!

Hi, we have seen a similar issue where files added or changed in groupfolders have not been recognized by the local clients.
After some testing we ended up with a small hack having one user with access to all groupfolders (“group_user”).
With crontab we trigger a script every minute on the server that iterates through all groupfolders and creates or deletes (depending on the state) a file that is excluded from synching. Afterwards we run the occ command with files:scan for that users files. This somehow tells the clients that something has changed and they synch correctly.
We are not setting the local variable for the forced sync.

FYI this is the script we run on the server:

cd /data/__groupfolders/
for dir in */; do
        if test -f "$dir/synch.part"; then
                rm -f "$dir/synch.part"
        else
                touch "$dir/synch.part"
        fi
done
php /var/www/html/occ files:scan --path=group_user/files/

Maybe that helps and solves your problem as well.
Best,
Christian