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

Catch node for share not found #26411

Closed
wants to merge 1 commit into from

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Apr 2, 2021

Fix #24891

Is this a god time to delete the share if the node doesn't exists?

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the fix/search-node-for-share-not-found branch from 3d1479d to 64a38cc Compare April 2, 2021 13:46
@skjnldsv
Copy link
Member Author

skjnldsv commented Apr 2, 2021

/backport to stable20

@skjnldsv
Copy link
Member Author

skjnldsv commented Apr 2, 2021

/backport to stable21

Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it's the right spot to catch it. The manager (or somewhere up the stack) might make more sense to call it? Same with unsharing (provided it is free of side effects – e.g. temporarily unavailable storage, but that SHOULD fail differently).

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rullzer rullzer mentioned this pull request Apr 8, 2021
3 tasks
@juliushaertl
Copy link
Member

I'm wondering a bit if in that scenario the cache is actually an instance of a FailedCache so we can just skip the search call in such a case in the view directly before the search is called when iterating over the mounts

$mountPoint = $mount->getMountPoint();
$storage = $mount->getStorage();
if ($storage) {
$cache = $storage->getCache('');
$relativeMountPoint = substr($mountPoint, $rootLength);
$results = call_user_func_array([$cache, $method], $args);

That would be a bit cleaner in my opinion, but hard to tell from the trace if that would work.

@rullzer rullzer modified the milestones: Nextcloud 21.0.1, Nextcloud 22 Apr 8, 2021
@skjnldsv
Copy link
Member Author

skjnldsv commented Apr 8, 2021

Fell free to find a better way. This is way out of my current php focus, this was a quickfix for proper catching. :)

This was referenced May 20, 2021
@blizzz blizzz mentioned this pull request Jun 2, 2021
57 tasks
@MorrisJobke MorrisJobke mentioned this pull request Jun 10, 2021
59 tasks
@blizzz blizzz mentioned this pull request Jun 16, 2021
45 tasks
@blizzz blizzz added 1. to develop Accepted and waiting to be taken care of and removed 3. to review Waiting for reviews labels Jun 16, 2021
@blizzz blizzz mentioned this pull request Jun 23, 2021
39 tasks
@blizzz blizzz modified the milestones: Nextcloud 22, Nextcloud 23 Jun 24, 2021
@MorrisJobke MorrisJobke removed their request for review July 4, 2021 11:34
@skjnldsv skjnldsv mentioned this pull request Oct 13, 2021
@skjnldsv skjnldsv modified the milestones: Nextcloud 23, Nextcloud 24 Oct 21, 2021
@skjnldsv skjnldsv mentioned this pull request Mar 24, 2022
@PVince81
Copy link
Member

please resolve the conflict, looks like a quick win

@blizzz blizzz mentioned this pull request Mar 31, 2022
This was referenced Apr 7, 2022
@blizzz blizzz modified the milestones: Nextcloud 24, Nextcloud 25 Apr 21, 2022
This was referenced Aug 12, 2022
@skjnldsv skjnldsv modified the milestones: Nextcloud 25, Nextcloud 26 Aug 18, 2022
@solracsf
Copy link
Member

solracsf commented Sep 6, 2022

Any chance to see this on v25 and backported?

@skjnldsv
Copy link
Member Author

skjnldsv commented Sep 6, 2022

Fixed already by e198dc1

@skjnldsv skjnldsv closed this Sep 6, 2022
@skjnldsv skjnldsv removed this from the Nextcloud 26 milestone Sep 6, 2022
@solracsf
Copy link
Member

solracsf commented Sep 6, 2022

@skjnldsv this happens in latest v22, isn't that commit included?

{
  "reqId": "5nyjmyhZ2oEdxcE8qk6U",
  "level": 3,
  "time": "2022-09-06T12:38:25+00:00",
  "app": "no app in context",
  "method": "POST",
  "url": "/ocs/v2.php/apps/files_sharing/api/v1/shares",
  "message": "Node for share not found, fileid: 61504727",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
  "version": "22.2.10.0",
  "exception": {
    "Exception": "OCP\\Files\\NotFoundException",
    "Message": "Node for share not found, fileid: 61504727",
    "Code": 0,
    "Trace": [
      {
        "file": "/app/lib/private/Share20/LegacyHooks.php",
        "line": 161,
        "function": "getNode",
        "class": "OC\\Share20\\Share",
        "type": "->",
        "args": []
      },
      {
        "file": "/app/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 264,
        "function": "postShare",
        "class": "OC\\Share20\\LegacyHooks",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\EventDispatcher\\GenericEventWrapper"
          },
          "OCP\\Share::postShare",
          {
            "__class__": "Symfony\\Component\\EventDispatcher\\EventDispatcher"
          }
        ]
      },
      {
        "file": "/app/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 239,
        "function": "doDispatch",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->",
        "args": [
          [
            {
              "__class__": "Closure"
            },
            {
              "__class__": "Closure"
            },
            {
              "__class__": "Closure"
            }
          ],
          "OCP\\Share::postShare",
          {
            "__class__": "OC\\EventDispatcher\\GenericEventWrapper"
          }
        ]
      },
      {
        "file": "/app/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 73,
        "function": "callListeners",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->",
        "args": [
          [
            {
              "__class__": "Closure"
            },
            {
              "__class__": "Closure"
            },
            {
              "__class__": "Closure"
            }
          ],
          "OCP\\Share::postShare",
          {
            "__class__": "OC\\EventDispatcher\\GenericEventWrapper"
          }
        ]
      },
      {
        "file": "/app/lib/private/EventDispatcher/SymfonyAdapter.php",
        "line": 123,
        "function": "dispatch",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\EventDispatcher\\GenericEventWrapper"
          },
          "OCP\\Share::postShare"
        ]
      },
      {
        "file": "/app/lib/private/Share20/Manager.php",
        "line": 820,
        "function": "dispatch",
        "class": "OC\\EventDispatcher\\SymfonyAdapter",
        "type": "->",
        "args": [
          "OCP\\Share::postShare",
          {
            "__class__": "Symfony\\Component\\EventDispatcher\\GenericEvent"
          }
        ]
      },
      {
        "file": "/app/apps/files_sharing/lib/Controller/ShareAPIController.php",
        "line": 661,
        "function": "createShare",
        "class": "OC\\Share20\\Manager",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Share20\\Share"
          }
        ]
      },
      {
        "file": "/app/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 217,
        "function": "createShare",
        "class": "OCA\\Files_Sharing\\Controller\\ShareAPIController",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Files\\Node\\Folder"
          },
          31,
          0,
          "xxx",
          "false",
          "",
          null,
          "",
          ""
        ]
      },
      {
        "file": "/app/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 126,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
          },
          "createShare"
        ]
      },
      {
        "file": "/app/lib/private/AppFramework/App.php",
        "line": 156,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
          },
          "createShare"
        ]
      },
      {
        "file": "/app/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Sharing\\Controller\\ShareAPIController",
          "createShare",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "_route": "ocs.files_sharing.ShareAPI.createShare"
          }
        ]
      },
      {
        "file": "/app/ocs/v1.php",
        "line": 62,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/files_sharing/api/v1/shares"
        ]
      },
      {
        "file": "/app/ocs/v2.php",
        "line": 23,
        "args": [
          "/app/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/app/lib/private/Share20/Share.php",
    "Line": 190,
    "CustomMessage": "--"
  },
  "id": "631760490f92a"
}

@skjnldsv skjnldsv deleted the fix/search-node-for-share-not-found branch October 19, 2022 15:21
@AndyXheli
Copy link
Contributor

@skjnldsv just got this error on NC 25.0.3 should i open a new issue regarding this ? loooks like is simular to this

{"reqId":"O9DzFvvrkGNfP8GgFdFS","level":3,"time":"2023-01-20T09:50:01-06:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job (class: OCA\\Files_Sharing\\ExpireSharesJob, arguments: )","userAgent":"--","version":"25.0.3.2","exception":{"Exception":"OCP\\Files\\NotFoundException","Message":"Node for share not found, fileid: 581588","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/sendent/lib/Listener/ShareDeletedListener.php","line":49,"function":"getNode","class":"OC\\Share20\\Share","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php","line":87,"function":"handle","class":"OCA\\Sendent\\Listener\\ShareDeletedListener","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":88,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":100,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Share20/Manager.php","line":1241,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Share20/Manager.php","line":1556,"function":"deleteShare","class":"OC\\Share20\\Manager","type":"->"},{"file":"/var/www/nextcloud/lib/private/Share20/Manager.php","line":1457,"function":"checkExpireDate","class":"OC\\Share20\\Manager","type":"->"},{"file":"/var/www/nextcloud/apps/files_sharing/lib/ExpireSharesJob.php","line":99,"function":"getShareById","class":"OC\\Share20\\Manager","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":78,"function":"run","class":"OCA\\Files_Sharing\\ExpireSharesJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/lib/private/Share20/Share.php","Line":194,"message":"Error while running background job (class: OCA\\Files_Sharing\\ExpireSharesJob, arguments: )","exception":[],"CustomMessage":"Error while running background job (class: OCA\\Files_Sharing\\ExpireSharesJob, arguments: )"},"id":"63cacd19b7ecd"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug feature: search high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node for share not found error
8 participants