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]: Backends provided no user object for <id> #120

Open
msviba opened this issue Jan 4, 2025 · 14 comments
Open

[Bug]: Backends provided no user object for <id> #120

msviba opened this issue Jan 4, 2025 · 14 comments
Labels
bug Something isn't working

Comments

@msviba
Copy link

msviba commented Jan 4, 2025

What happened?

I see errors in log.

Relevant log output

{"reqId":"dOfaJByrrdUy44ANXszj","level":3,"time":"2025-01-04T07:56:23+00:00","remoteAddr":"2a00***5d42","user":"michal","app":"files","method":"GET","url":"/apps/duplicatefinder/api/duplicates/all?limit=50&page=1","message":"Backends provided no user object for vbxh7ce8","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36","version":"30.0.4.1","exception":{"Exception":"OC\\User\\NoUserException","Message":"Backends provided no user object","Code":0,"Trace":[{"function":"getUserFolder","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/var/cloud/nc/lib/private/Files/Node/LazyFolder.php","line":64,"function":"call_user_func_array"},{"file":"/var/cloud/nc/lib/private/Files/Node/LazyRoot.php","line":38,"function":"__call","class":"OC\\Files\\Node\\LazyFolder","type":"->"},{"file":"/var/cloud/nc/apps/duplicatefinder/lib/Service/ShareService.php","line":76,"function":"getUserFolder","class":"OC\\Files\\Node\\LazyRoot","type":"->"},{"file":"/var/cloud/nc/apps/duplicatefinder/lib/Service/FileInfoService.php","line":696,"function":"hasAccessRight","class":"OCA\\DuplicateFinder\\Service\\ShareService","type":"->"},{"file":"/var/cloud/nc/apps/duplicatefinder/lib/Service/FileDuplicateService.php","line":219,"function":"hasAccessRight","class":"OCA\\DuplicateFinder\\Service\\FileInfoService","type":"->"},{"file":"/var/cloud/nc/apps/duplicatefinder/lib/Service/FileDuplicateService.php","line":178,"function":"stripFilesWithoutAccessRights","class":"OCA\\DuplicateFinder\\Service\\FileDuplicateService","type":"->"},{"file":"/var/cloud/nc/apps/duplicatefinder/lib/Controller/DuplicateApiController.php","line":58,"function":"findAll","class":"OCA\\DuplicateFinder\\Service\\FileDuplicateService","type":"->"},{"file":"/var/cloud/nc/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"list","class":"OCA\\DuplicateFinder\\Controller\\DuplicateApiController","type":"->"},{"file":"/var/cloud/nc/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/cloud/nc/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/cloud/nc/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/cloud/nc/lib/base.php","line":1003,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/cloud/nc/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/cloud/nc/lib/private/Files/Node/Root.php","Line":345,"message":"Backends provided no user object for vbxh7ce8","exception":[],"CustomMessage":"Backends provided no user object for vbxh7ce8"},"id":"6778ea22605cc"}

Version

30.x

Installation Type

Standard Installation

Additional context

version 1.6.0

@msviba msviba added the bug Something isn't working label Jan 4, 2025
@msviba
Copy link
Author

msviba commented Jan 4, 2025

Another with user id:

{
  "reqId": "OX7db2OMv4RaHjyLPEFV",
  "level": 3,
  "time": "2025-01-04T07:48:41+00:00",
  "remoteAddr": "2a00:***:6fdf",
  "user": "michal",
  "app": "files",
  "method": "POST",
  "url": "/apps/duplicatefinder/api/duplicates/find",
  "message": "Backends provided no user object for michal@cloud****/",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
  "version": "30.0.4.1",
  "exception": {
    "Exception": "OC\\User\\NoUserException",
    "Message": "Backends provided no user object",
    "Code": 0,
    "Trace": [
      {
        "function": "getUserFolder",
        "class": "OC\\Files\\Node\\Root",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Node/LazyFolder.php",
        "line": 64,
        "function": "call_user_func_array"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Node/LazyRoot.php",
        "line": 38,
        "function": "__call",
        "class": "OC\\Files\\Node\\LazyFolder",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Service/FolderService.php",
        "line": 40,
        "function": "getUserFolder",
        "class": "OC\\Files\\Node\\LazyRoot",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Service/FileInfoService.php",
        "line": 522,
        "function": "getNodeByFileInfo",
        "class": "OCA\\DuplicateFinder\\Service\\FolderService",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Listener/FileInfoListener.php",
        "line": 65,
        "function": "calculateHashes",
        "class": "OCA\\DuplicateFinder\\Service\\FileInfoService",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/EventDispatcher/ServiceEventListener.php",
        "line": 68,
        "function": "handle",
        "class": "OCA\\DuplicateFinder\\Listener\\FileInfoListener",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 220,
        "function": "__invoke",
        "class": "OC\\EventDispatcher\\ServiceEventListener",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 56,
        "function": "callListeners",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/EventDispatcher/EventDispatcher.php",
        "line": 67,
        "function": "dispatch",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/EventDispatcher/EventDispatcher.php",
        "line": 79,
        "function": "dispatch",
        "class": "OC\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Service/FileInfoService.php",
        "line": 270,
        "function": "dispatchTyped",
        "class": "OC\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Utils/ScannerUtil.php",
        "line": 100,
        "function": "save",
        "class": "OCA\\DuplicateFinder\\Service\\FileInfoService",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Utils/ScannerUtil.php",
        "line": 89,
        "function": "saveScannedFile",
        "class": "OCA\\DuplicateFinder\\Utils\\ScannerUtil",
        "type": "->"
      },
      {
        "function": "OCA\\DuplicateFinder\\Utils\\{closure}",
        "class": "OCA\\DuplicateFinder\\Utils\\ScannerUtil",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/cloud/nc/lib/private/Hooks/EmitterTrait.php",
        "line": 88,
        "function": "call_user_func_array"
      },
      {
        "file": "/var/cloud/nc/lib/private/Hooks/PublicEmitter.php",
        "line": 22,
        "function": "emit",
        "class": "OC\\Hooks\\BasicEmitter",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Utils/Scanner.php",
        "line": 119,
        "function": "emit",
        "class": "OC\\Hooks\\PublicEmitter",
        "type": "->"
      },
      {
        "function": "OC\\Files\\Utils\\{closure}",
        "class": "OC\\Files\\Utils\\Scanner",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/cloud/nc/lib/private/Hooks/EmitterTrait.php",
        "line": 88,
        "function": "call_user_func_array"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Cache/Scanner.php",
        "line": 228,
        "function": "emit",
        "class": "OC\\Hooks\\BasicEmitter",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Cache/Scanner.php",
        "line": 501,
        "function": "scanFile",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Cache/Scanner.php",
        "line": 425,
        "function": "handleChildren",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Cache/Scanner.php",
        "line": 430,
        "function": "scanChildren",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Cache/Scanner.php",
        "line": 430,
        "function": "scanChildren",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Cache/Scanner.php",
        "line": 331,
        "function": "scanChildren",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Files/Utils/Scanner.php",
        "line": 255,
        "function": "scan",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Utils/ScannerUtil.php",
        "line": 66,
        "function": "scan",
        "class": "OC\\Files\\Utils\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Service/FileInfoService.php",
        "line": 618,
        "function": "scan",
        "class": "OCA\\DuplicateFinder\\Utils\\ScannerUtil",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Controller/DuplicateApiController.php",
        "line": 140,
        "function": "scanFiles",
        "class": "OCA\\DuplicateFinder\\Service\\FileInfoService",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/User/Manager.php",
        "line": 533,
        "function": "OCA\\DuplicateFinder\\Controller\\{closure}",
        "class": "OCA\\DuplicateFinder\\Controller\\DuplicateApiController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/cloud/nc/apps/duplicatefinder/lib/Controller/DuplicateApiController.php",
        "line": 139,
        "function": "callForAllUsers",
        "class": "OC\\User\\Manager",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 208,
        "function": "find",
        "class": "OCA\\DuplicateFinder\\Controller\\DuplicateApiController",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 114,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/cloud/nc/lib/base.php",
        "line": 1003,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/cloud/nc/index.php",
        "line": 24,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/cloud/nc/lib/private/Files/Node/Root.php",
    "Line": 345,
    "message": "Backends provided no user object for michal@cloud****/",
    "exception": [],
    "CustomMessage": "Backends provided no user object for michal@cloud****/"
  },
  "id": "6778eb103400c"
}

@eldertek

This comment has been minimized.

@msviba

This comment has been minimized.

@eldertek

This comment has been minimized.

@msviba

This comment has been minimized.

@eldertek

This comment has been minimized.

@ASerbinski

This comment has been minimized.

@eldertek eldertek closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2025
@ASerbinski

This comment has been minimized.

@eldertek eldertek reopened this Jan 22, 2025
Repository owner deleted a comment from github-actions bot Jan 22, 2025
@eldertek
Copy link
Owner

eldertek commented Jan 22, 2025

Could you add the last commit I just pushed? It includes more debugging. Can you clone the repo to your Nextcloud instance and then send me your debug.log, please?

Also, could you add me on Discord? My username is eldertek.

@ASerbinski
Copy link

Hi @eldertek ;

I don't use discord, so I won't be able to communicate with you there, however I have dug into this issue deeper, with clues gathered from the commit you added last night.

With that commit, it seems to actually be working. Its still throwing the no user object error into the log, but its continuing from that point rather than aborting. From the commandline, there is no error being thrown, probably because I haven't run it with verbose output yet, and its backed the issue down to a debug level rather than error.

I think I'm understanding this problem now.

It comes down to "Backends provided no user object for {something}". In my case, {something} is "bg69ur3o". I found tons of references to that in my database.

oc_talk_rooms.token
oc_share.share_with

Most shares have oc_share.share_with set to the recipient uid, but not these ones with Talk.

So what is going on, is that something is being shared with a TALK ROOM, rather than a user, which is why there is no user object for it!

I believe that the correct handling for this situation is simply to not fatally bail out, just move on.

@eldertek
Copy link
Owner

Thanks for the detailed investigation! Your analysis is spot-on - the issue occurs when files are shared with Talk rooms (which have 8-character tokens like "bg69ur3o") rather than regular users.

I've just pushed a commit that improves how we handle Talk room shares:

  1. Added detection for Talk room tokens (8-character alphanumeric strings)
  2. Changed the behavior to gracefully skip Talk room shares instead of treating them as errors
  3. Moved the logging from error to debug level since this is expected behavior
  4. Added more detailed debug logging to help track these cases

Could you please test this new commit to verify it resolves the issue for you? The logs will still show the "no user object" messages but at debug level, and the application should continue processing without problems.

Let me know if you see any issues or if further adjustments are needed.

@ASerbinski
Copy link

ASerbinski commented Jan 24, 2025

I think this commit is not a good idea;

169f444

Reason being.... what happens if someone has a UID that is 8 character alphanum, like "patricia"?

Also, while I do have that commit in, I think your regex isn't quite right, because its not catching the talk room token at all on mine. I get "Checking access list", then "Access list retrieved", and then "Backends provided no user object for bg69ur3o".

Its also NOT printing the "No user object found (possibly Talk room)" warning, but rather jumping straight to the "Failed to check access rights" error.

I think a way better approach to this would be to use IUserManager->get($user) !== null to validate the user. That function returns null if the user doesn't exist.

Edit....

Ah, I see what's going on.... the regex didn't catch it because the value of $user will never be a Talk room token. The issue isn't in the $user variable at all! Its in $shares[0]->getSharedWith() ----> ShareService.php:99

Solution: ShareService.php:95
if (!empty($shares) && $userManager->get($shares[0]->getSharedWith()) != null){

Alternative, or in addition: ShareService.php:40
Remove some share types that don't have a user folder, like IShare::TYPE_ROOM

@eldertek
Copy link
Owner

Hi, could you try this commit please :) bfee6c4

@ASerbinski
Copy link

That commit seems to be working well. All that's left is a NotFoundException at line 107 from $node->getParent() which is making quite a mess in the logs. Presumably every time it is walking up to the root where it can't find a parent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants