nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.71k stars 4k forks source link

[Bug]: Rejecting share for a file that is no longer exist is not working #35069

Open elhananjair opened 1 year ago

elhananjair commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

There are pending shares listed that I haven't either rejected or accepted for a long time. When I tried to reject those shares, it shows, "Something happened. Unable to reject the share."

Those files don't exist anymore or might be moved that's the reason behind it.

Steps to reproduce

  1. Share some files with another user
  2. Move or delete that file
  3. The other user can not accept or reject the file

Expected behavior

Such pending shares shouldn't be shown in the first place.

Installation method

Community Manual installation with Archive

Operating system

RHEL/CentOS

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

PostgreSQL

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

No response

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "session_keepalive": false,
        "auto_logout": true,
        "trusted_domains": [
            "SOME URL"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "25.0.1.1",
        "overwrite.cli.url": "https:\/\/nextacso.com\/",
        "htaccess.RewriteBase": "\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "filelocking.enabled": true,
        "skeletondirectory": "",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "allow_local_remote_servers": true,
        "default_phone_region": "ET",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "app_install_overwrite": [
            "music",
            "pdfdraw",
            "dashboardcharts",
            "whiteboard",
            "files_texteditor",
            "rainloop",
            "files_mindmap",
            "flow_notifications",
            "files_trackdownloads",
            "apporder",
            "quicknotes",
            "extract",
            "data_request",
            "drawio"
        ],
        "maintenance": false,
        "loglevel": 3,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [
            "IT Team"
        ],
        "twofactor_enforced_excluded_groups": [
           "Some Groups"
        ],
        "mail_smtpsecure": "ssl",
        "theme": "",
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "updater.release.channel": "stable",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - admin_audit: 1.15.0
  - analytics: 4.5.0
  - announcementcenter: 6.4.0
  - appointments: 1.14.0
  - apporder: 0.15.0
  - approval: 1.0.10
  - bruteforcesettings: 2.5.0
  - calendar: 4.1.0
  - calendar_resource_management: 0.3.1
  - camerarawpreviews: 0.8.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contacts: 5.0.1
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - data_request: 1.11.0
  - dav: 1.24.0
  - deck: 1.8.1
  - drawio: 1.0.3
  - event_update_notification: 2.0.0
  - external: 5.0.0
  - extract: 1.3.5
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_accesscontrol: 1.15.0
  - files_automatedtagging: 1.15.0
  - files_downloadactivity: 1.15.0
  - files_external: 1.17.0
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_texteditor: 2.14.0
  - files_trackdownloads: 1.11.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - flow_notifications: 1.4.0
  - forms: 3.0.1
  - geoblocker: 0.5.7
  - groupfolders: 13.0.0
  - guests: 2.3.0
  - integration_github: 1.0.12
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - maps: 0.2.1
  - metadata: 0.17.0
  - music: 1.7.0
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - photos: 2.0.0
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - quicknotes: 0.8.1
  - quota_warning: 1.15.0
  - recommendations: 1.4.0
  - registration: 2.0.0
  - related_resources: 1.0.3
  - richdocuments: 7.0.1
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - snappymail: 2.20.6
  - spreed: 15.0.1
  - support: 1.8.0
  - survey_client: 1.13.0
  - suspicious_login: 4.3.0
  - systemtags: 1.15.0
  - tasks: 0.14.5
  - text: 3.6.0
  - theming: 2.0.1
  - theming_customcss: 1.12.0
  - twofactor_backupcodes: 1.14.0
  - updatenotification: 1.15.0
  - user_ldap: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflow_ocr: 1.25.1
  - workflow_pdf_converter: 1.10.0
  - workflowengine: 2.7.0
Disabled:
  - duplicatefinder: 0.0.15
  - encryption: 2.13.0
  - files_markdown: 2.3.6
  - files_mindmap: 0.0.26
  - flowupload: 1.1.3
  - login_notes: 1.1.0
  - talked: 0.4.0
  - twofactor_totp: 6.0.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

None related to this issue.

Additional info

image

PVince81 commented 1 year ago

Please verify if your cron is running properly, this background job is designed to delete shares where a file does not exist any more: https://github.com/nextcloud/server/blob/stable25/apps/files_sharing/lib/DeleteOrphanedSharesJob.php#L57

You can check the oc_jobs table for this name and check if the last_run is recent.

If it ran fine, then perhaps the file is not properly/fully deleted or in a weird state, so might need to look in the database. Maybe first run an "occ files:scan --all" to make sure the filecache is alright.

elhananjair commented 1 year ago

@PVince81 The cron is running properly. image I have executed occ files:scan --all too image

nextcloud-command commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

elhananjair commented 1 year ago

@PVince81 this issue is about to close automagically 🙂

PVince81 commented 1 year ago

you have already provided the info so I should have removed the "needs info" label.

so this tells us that there is no background job that cleans up this kind of shares

this will need someone to dig into the code and implement a fix

joshtrichards commented 1 year ago

Hi @elhananjair - Can you confirm the background job that handles these is actually running:

Either:

./occ background-job:list -l 100 | grep Orphan

Or as @PVince81 noted:

You can check the oc_jobs table for this name and check if the last_run is recent.

elhananjair commented 1 year ago

./occ background-job:list -l 100 | grep Orpha This doesn't output anything.

The cron job is running fine.

You can check the oc_jobs table for this name and check if the last_run is recent.: This is the output I get checking the oc_jobs table

id | class | argument | last_run | last_checked | reserved_at | exe cution_duration | argument_hash | time_sensitive --------+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+------------+--------------+-------------+---- ----------------+----------------------------------+---------------- 167362 | OC\Security\VerificationToken\CleanUpJob | "{\"userId\":\"NCuserl\",\"subject\":\"lostpassword\",\"pp\":\"user@gmail.com\",\"notBefore\":1693895744}" | 0 | 1693375391 | 0 |
0 | 8de6d669ca4e13d0a4b62809bd933dd0 | 1

elhananjair commented 1 week ago

@PVince81 Hello there, time flies I see some changes on this issue, running the latest Nextcloud instance on a different server, if I share a file from one usera to userb and delete the file before the user rejects or accepts it, the share notification won't appear on the notification or on pending shares category.

But on my another Nextcloud instance which I referred to here on this issue, I still couldn't reject shares that are very old and might not even exist.