server icon indicating copy to clipboard operation
server copied to clipboard

occ files_external:notify does not propogate changes to clients.

Open ariselseng opened this issue 9 years ago • 107 comments

Steps to reproduce

  1. Mount a windows share in nextcloud
  2. Let a desktop client sync the share.
  3. Run occ files_external:notify -v <mount_id>
  4. Make some changes remote, directly to the windows share by other means.

Expected behaviour

The desktop clients should propogate the changes that happened directly to the SMB share.

Actual behaviour

I get the changes listed out in the terminal output of the occ files_external:notify command, but nothing else happens.

Server configuration

Operating system: Ubuntu Server 16.04 Web server: Nginx 1.10

Database: Mariadb 10 PHP version: 7.0/7.1 (tried both) Nextcloud version: (see Nextcloud admin page) 11.0.1 and 11.0.2 (tried both)

Updated from an older Nextcloud/ownCloud or fresh install: Upgrade. Where did you install Nextcloud from: Wonderfall/nextcloud:latest

Client configuration

Operating system: Elementary with nextcloud-client 2.2.4

ariselseng avatar Feb 17 '17 10:02 ariselseng

@icewind1991

nickvergessen avatar Feb 22 '17 12:02 nickvergessen

I have the same issue. Any idea to fix it ?

Update : I can not see the reference of the new file in the table oc_filecache

ymolinet avatar Mar 20 '17 13:03 ymolinet

This issue is a major problem for us because file change by a local SMB Share are not propagate to the nextcloud client. We can help you to fix this issue if we can understand how the sync process works and how the SMB notify works in Nextcloud.

ymolinet avatar Mar 22 '17 08:03 ymolinet

@icewind1991

nickvergessen avatar Mar 23 '17 16:03 nickvergessen

up ?

ymolinet avatar Mar 27 '17 15:03 ymolinet

I'm working on this issue, and I have a question. In apps\files_external\lib\Command\Notify.php, I can found the function that it call by the notify command. In the execute function (at line 90), I can found only the request to update a files already register in file_cache table, but no method to add or remove files....

ymolinet avatar Mar 28 '17 14:03 ymolinet

If I understand the process correctly, another issue is possible. External_Storage are register as mount point in oc_mounts. Each user that use an external storage refer it by a storage id. The storage id is use to refer the file in oc_filecache.

So, if a user push a file (from web ou client), it is refer in his storage, but all other are not updated ...

ymolinet avatar Mar 29 '17 13:03 ymolinet

Anyone could explained how NextCloud get file data to store it in the filecache table? especially mimetype list, mimepart, etag, permissions

ymolinet avatar Mar 29 '17 16:03 ymolinet

The notify command doesn't write the new info to the filecache itself.

It marks a folder as out-of-date (setting it's size to -1), the background scanner (cron) will then detect that and handle updating the cache.

If you're running into issues with the cache not being updated while the notify command works fine, please verify that nextcloud's cron job is running correctly

icewind1991 avatar Mar 29 '17 17:03 icewind1991

So notify works only if a file or folder is changed, what's happen if we add a file ? In addition, scan must have the credential to access to the share especially if we use credential session (ldap user).

ymolinet avatar Mar 29 '17 17:03 ymolinet

For new files the folder is also marked as outdated and the scanner will find the new files.

session credentials might indeed cause issues, not sure, will investigate later

icewind1991 avatar Mar 29 '17 17:03 icewind1991

If we use the session credential, scan can occur only if the user is connected to the web interface. It could be interresting to allow scan when the user is connected throw the windows client (could be an option to enable in the admin panel).

ymolinet avatar Mar 31 '17 13:03 ymolinet

If I correctly understand, the windows client use WebDAV to connect with NextCloud. it could be interresting to invoque the cron (like ajax cron) when a user log on by Nextcloud client.

ymolinet avatar Apr 04 '17 07:04 ymolinet

is it possible to run two cron jobs? one every minute that only for checking if a folder has been marked as updated? and the other for everything else. I have my cron time set to 15min, so it takes up to 15 minutes before a change is synced.

ariselseng avatar Apr 07 '17 08:04 ariselseng

I think you can not solve this problem with two cron. Your second job need to have the user credential store somewhere. If (like me) you used the credential in the session, NextCloud don't have the login/password to connect to the remote share.

ymolinet avatar Apr 11 '17 08:04 ymolinet

Multiple parallel cron jobs are supported since NC 10 I think

nickvergessen avatar Apr 11 '17 08:04 nickvergessen

Up ?

ymolinet avatar Apr 23 '17 14:04 ymolinet

I think that the best way to fix this issue is to create a "new" way to scan the files. A scan method, running with a remote account can read permissions on the remote share and associate it with nextcloud user ... (LDAP Account).

ymolinet avatar Apr 26 '17 09:04 ymolinet

Is it possible to have informations about the file_cache table (column description and waiting values)

ymolinet avatar Apr 26 '17 09:04 ymolinet

I think a problem exist with the markParentAsOutdated function because it use dirname() php method. under Windows, this method use / and \ to parse the directory, but under Linux it use only /. So when Nextcloud is running under linux and check a Windows path, the parent directory is not correctly parse ...

ymolinet avatar May 22 '17 11:05 ymolinet