Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Shares missing in web when 'mount_provider_class' is empty #34752

Closed
6 of 9 tasks
Tracked by #1280
SystemKeeper opened this issue Oct 23, 2022 · 29 comments · Fixed by #35218
Closed
6 of 9 tasks
Tracked by #1280

[Bug]: Shares missing in web when 'mount_provider_class' is empty #34752

SystemKeeper opened this issue Oct 23, 2022 · 29 comments · Fixed by #35218

Comments

@SystemKeeper
Copy link
Contributor

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

After upgrading to NC 25 I noticed that shared files in talk could not be opened in web. After looking closer, I found that no files shared with me were visible in /Talk.

In nextcloud.log I found the following:

{
  "reqId": "am3emaAzRYJCvr5mf6b1",
  "level": 0,
  "time": "2022-10-23T12:30:27+02:00",
  "remoteAddr": "172.31.2.89",
  "user": "marcel.mueller",
  "app": "no app in context",
  "method": "PROPFIND",
  "url": "/remote.php/dav/files/marcel.mueller/Talk",
  "message": "mount at /marcel.mueller/files/Talk/<some file>/ has no provider set, performing full setup",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",
  "version": "25.0.0.18",
  "data": []
}

Looking at the database, this file had no mount_provider_class set for my user, but was set for others:


nextcloud_db=> SELECT * FROM oc_mounts WHERE mount_point LIKE '%<some file>%';
  id   | storage_id | root_id |     user_id     |            mount_point                  | mount_id |      mount_provider_class
-------+------------+---------+-----------------+-----------------------------------------+----------+---------------------------------
 12181 |         19 |  593503 | marcel.mueller  | /marcel.mueller/files/Talk/<some file>/ |          |
  6554 |         19 |  593503 | --------------  | /--------------/files/Talk/<some file>/ |          | OCA\Files_Sharing\MountProvider
  6552 |         19 |  593495 | ------------    | /------------/files/Talk/<some file>/   |          | OCA\Files_Sharing\MountProvider

After setting the mount_provider_class for this file to OCA\Files_Sharing\MountProvider as well:

UPDATE oc_mounts SET mount_provider_class = 'OCA\Files_Sharing\MountProvider' WHERE id = 12181;

The shared files were visible again for me in web. Also I am able to open files shared with me in talk-web again.
This issue was only present on web, I had no problems with the Files iOS app for example (every share was visible).

There are quite a few files which miss the mount_provider_class:

nextcloud_db=> SELECT COUNT(*) FROM oc_mounts WHERE mount_provider_class IS NULL;
 count
-------
   290
(1 Zeile)

PROPFIND with user/passwort:

curl -u marcel.mueller:<password> 'https://<nc-host>/remote.php/dav/files/marcel.mueller/Talk' -X PROPFIND --data '<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns">
  <d:prop> 
    <d:getlastmodified /> 
    <d:getetag />     
    <d:getcontenttype />   
    <d:resourcetype />
    <oc:fileid />
    <oc:permissions />
    <oc:size />
    <d:getcontentlength />
    <d:quota-available-bytes />
    <nc:has-preview />
    <nc:mount-type />
    <nc:is-encrypted />
    <ocs:share-permissions />
    <nc:share-attributes />
    <oc:tags />
    <oc:favorite />
    <oc:owner-id />
    <oc:owner-display-name />
    <oc:share-types />
    <oc:comments-unread />
  </d:prop>
  </d:propfind>' -so /dev/null -w '%{size_download}'
1054144

The same one from web returned only a size of 416672 (before the database change)

Steps to reproduce

  1. Have a file shared in a folder with you (eg. share a file from talk, so it ends up in /Talk)
  2. Set the mount_provider_class to NULL for that file in oc_mounts
  3. Notice, that files shared with you are no longer visible in web

Expected behavior

Files should be visible even if mount_provider_class is not set.
Maybe add a occ command to fix missing mount provider classes?

Installation method

Community Manual installation with Archive

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "htaccess.RewriteBase": "\/",
        "dbtype": "pgsql",
        "version": "25.0.0.18",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "sendmail",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "log_type": "syslog",
        "logtimezone": "Europe\/Berlin",
        "logfile": "",
        "loglevel": 0,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\TIFF"
        ],
        "maintenance": false,
        "theme": "",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "preview_max_x": 1024,
        "preview_max_y": 1024,
        "preview_max_scale_factor": 1,
        "skeletondirectory": "",
        "updater.release.channel": "beta",
        "default_language": "de",
        "app_install_overwrite": [
            "mindmap_app",
            "files_mindmap",
            "documentserver_community",
            "onlyoffice",
            "tasks",
            "polls",
            "previewgenerator",
            "forms",
            "issuetemplate",
            "spreed"
        ],
        "trashbin_retention_obligation": "auto, 30",
        "default_phone_region": "DE",
        "allow_local_remote_servers": true
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - admin_audit: 1.15.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - deck: 1.8.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - forms: 3.0.0
  - integration_github: 1.0.12
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - notifications: 2.13.1
  - notify_push: 0.5.0
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - photos: 2.0.0
  - polls: 4.0.0
  - previewgenerator: 5.1.0
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - related_resources: 1.0.1
  - richdocuments: 7.0.0
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - spreed: 15.0.0
  - systemtags: 1.15.0
  - tasks: 0.14.5
  - text: 3.6.0
  - theming: 2.0.0
  - twofactor_backupcodes: 1.14.0
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - bruteforcesettings: 2.4.0
  - calendar: 4.1.0-rc.1
  - checksum: 1.1.4
  - collectives: 2.0.0-beta3
  - contacts: 5.0.1
  - contactsinteraction: 1.4.0
  - encryption
  - files_antivirus: 3.3.1
  - files_automatedtagging: 1.15.0
  - files_external
  - files_retention: 1.14.0
  - firstrunwizard: 2.12.0
  - flow_notifications: 1.4.0
  - groupfolders: 13.0.0
  - guests: 2.3.0
  - integration_whiteboard: 0.0.15
  - issuetemplate: 0.7.0
  - keeweb: 0.6.9
  - metadata: 0.16.0
  - nextcloud_announcements: 1.5.0
  - onlyoffice: 7.5.4
  - ransomware_protection: 1.13.0
  - recommendations: 0.4.0
  - support: 1.6.0
  - survey_client: 1.11.0
  - suspicious_login
  - theming_customcss: 1.12.0
  - twofactor_totp
  - user_ldap
  - workflow_pdf_converter: 1.10.0
  - workflow_script: 1.9.0

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@SystemKeeper SystemKeeper added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Oct 23, 2022
@SystemKeeper
Copy link
Contributor Author

So this does not happen with all files. When I just set the mount_provider_class to NULL for a random file, everything still works and the mount_provider_class is correctly set after the page is reloaded. I still have a user and a file where this problem occurs.
Maybe someone can point me in the right direction on how to find out what's special about this user/file?!

@PVince81
Copy link
Member

I expect that this #33540 should already fix this.
please try with 25.0.1 RC 1

if the problem persists, feel free to reopen

@PVince81
Copy link
Member

cc @icewind1991

@SystemKeeper
Copy link
Contributor Author

@PVince81 #33540 is already included in 25.0.0 if I'm not mistaken? Only the backport to 24 was missing?

@PVince81
Copy link
Member

right, so possibly that one didn't catch everything like your issue

@szaimen
Copy link
Contributor

szaimen commented Nov 10, 2022

@icewind1991 could you maybe take a look at this? :)

@r-mamchur
Copy link

On my occasion, privileges on some files, granted implicitly through conversations, were be lost.
The files with the message "has no provider set, performing full setup".
After
UPDATE oc_mounts SET mount_provider_class = 'OCA\Files_Sharing\MountProvider' ..
updated records were deleted from oc_mounts by a background job.
Of course, the files were not shared anymore so, the record is a mistake. :-((

@PVince81 PVince81 added regression 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Nov 15, 2022
@PVince81
Copy link
Member

@icewind1991 would clearing oc_mounts be a good workaround then ?

@PVince81
Copy link
Member

note: there's more info in #34976 about different affected setups

@PVince81
Copy link
Member

potentially related to #34976 (comment)

probably need another approach for the fix?

@icewind1991
Copy link
Member

The setup logic should fallback to performing a complete setup when it finds a cached mountpoint without a mount_provider_class set, so I'm confused why setting it fixes the issue for people

@icewind1991
Copy link
Member

If somebody that has the issue and has the ability to attach a debugger or add some debug logging to check what the value of $cachedMount is from

$cachedMount = $this->userMountCache->getMountForPath($user, $path);
when they try to open the missing shared file it would be a great help.

When trying to open the files the setupForPath should be called with the path of the file, and the $cachedMount->getMountPoint() should be the path of the share

@XueSheng-GIT
Copy link

@icewind1991
I've added following line for debugging (below line 405, mentioned by you):

$this->logger->info('user->getUID: ' . $user->getUID() . ', path: ' . $path . ', getMountPoint: ' . $cachedMount->getMountPoint());

Log entry for a missing Talk file is:

user->getUID: user_uid, path: /user_uid/files/Talk, getMountPoint: /user_uid/

This is followed by the default log output of line:

$this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup");

Log entry:

mount at /user_uid/files/Talk/IMG_20210215_164005_928.jpg/ has no provider set, performing full setup

Does this make sense for you somehow? Please let me know if you need further debugging lines.

@SystemKeeper
Copy link
Contributor Author

@icewind1991 I'm sorry, I am a bit lost here. First I tried to dump $cachedMount somehow (print_r, var_dump, var_export, etc.), this wouldn't work, because either it complained about a circular reference and or memory was exhausted.
Printing just $cached->getMountPoint() results in /<user>/ when opening the Talk folder of <user>.

I can't access the file directly, because it's not visible in the web interface. Opening the directory with the iOS app does show shared files, but this one is not listed.

Trying to do a direct download like

curl -u <....> -H "OCS-APIRequest: true" -X POST "https://<...>/ocs/v2.php/apps/dav/api/v1/direct" -d "fileId=208394"

results in

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>failure</status>
  <statuscode>404</statuscode>
  <message></message>
 </meta>
 <data/>
</ocs>

When I try https://<...>/apps/files/?dir=/Talk&openfile=208394 I fall back to the folder /Talk.

Trying what @XueSheng-GIT suggested results in the same

user->getUID: <user>, path: /<user>/files/Talk, getMountPoint: /<user>/

Let me know what you need!

@SystemKeeper
Copy link
Contributor Author

In the current case the file was shared to a talk conversation (as seen above), but that particular user is not part of the conversation anymore. Maybe relevant - could you check on your side @XueSheng-GIT if that's the case as well?

@XueSheng-GIT
Copy link

In my case it seems to mainly affect one user. The user who shared the file is still part of the room (conversation).

@SystemKeeper
Copy link
Contributor Author

The user who shared the file is still part of the room (conversation).

The user who shared, yes, but also the „problematic“ user?

In my case User A shared a file to a conversation, where User B was a participant at some point. Now User B is not a participant anymore, but the file is still listed in the oc_mounts.

@XueSheng-GIT
Copy link

The user who shared, yes, but also the „problematic“ user?

Yes, the problematic user (user B in your example) is still in the room.

@SystemKeeper
Copy link
Contributor Author

Okay, then it might not be related at all. Thanks for checking!

@icewind1991
Copy link
Member

Thanks for the info!

@szaimen
Copy link
Contributor

szaimen commented Nov 16, 2022

To be clear, this also happens on 24.0.7. So I think it is very important to fix this as soon as possible...

@r-mamchur
Copy link

In my case, User who shared the problem files to a conversation, was disabled about 6 months ago. He is still in the conversation for keeping links to his files in context conversation.

@szaimen
Copy link
Contributor

szaimen commented Nov 16, 2022

Workaround for now: #34976 (comment)

@icewind1991
Copy link
Member

icewind1991 commented Nov 16, 2022

Finally managed to reproduce this one.

The issue only occurs if some of the shares in a folder have an empty mount provider. If all they all have an empty mount provider the migration kicks in as expected.

#35218 should fix it, please try applying the patch and see if it works for you

@szaimen szaimen added 2. developing Work in progress and removed 1. to develop Accepted and waiting to be taken care of labels Nov 16, 2022
@XueSheng-GIT
Copy link

@icewind1991 thanks a lot! Works in my case, missing shares are shown again in Talk folder!

@fenvarien
Copy link

Finally managed to reproduce this one.

The issue only occurs if some of the shares in a folder have an empty mount provider. If all they all have an empty mount provider the migration kicks in as expected.

#35218 should fix it, please try applying the patch and see if it works for you

I can confirm, that this patch is working with 24.0.7, too. All the shares in the shared folder are back in action. Thank you!

@XueSheng-GIT
Copy link

XueSheng-GIT commented Nov 18, 2022

After applying the patch, collectives is not working anymore (folder '/Kollektive' cannot be accessed).
Browser console error:

XHRPROPFINDhttps://cloud.domain.de/remote.php/dav/files/user_id/Kollektive
[HTTP/1.1 504 Gateway Time-out 60010ms]

After restoring the original SetupManager.php, Collectives works again and '/Kollektive' folder is accessible!
Tested on NC25.0.1 and NC24.0.7!

@icewind1991 Can you have a second look???

UPDATE:
It seems #35218 was updated yesterday, thus the diff I was using was already outdated. After re-applying the latest diff, Collectives is working again! Sorry for this confusion.

@dsisysteme
Copy link

dsisysteme commented Jan 5, 2023

We have the same problem following an update to 24.0.8.
We have many rows (Shared) in oc_mounts which do not have the class OCA\Files_Sharing\MountProvider
This does not concern all users but those who do not have the class cannot access the shared_folder.

MariaDB [nextcloud]> SELECT count(*) FROM oc_mounts WHERE mount_provider_class IS NULL and mount_point like "%/Shared/%";
+----------+
| count(*) |
+----------+
|     1654 |
+----------+
1 row in set (0,223 sec)

As it seems related, we are hit by:

It seems that the patch does not fix all the problems.

@dsisysteme
Copy link

We have found the cause of our errors.

We had a share which had as uid_owner=user1 and share_whith=user1.
This appears to be an old ownership transfer bug.
This had no impact until the switch to 24.0.8. This bad sharing caused a loop that crashed php processes.

This loop prevented the execution of the above patch, which led us in the wrong direction in the resolution of this incident.

Sorry for the false alarm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants