nextcloud / files_fulltextsearch

🔍 Index the content of your files
GNU Affero General Public License v3.0
59 stars 30 forks source link

[Bug]: `NoUserException` `Backends provided no user object` #292

Open cdhermann opened 4 months ago

cdhermann commented 4 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

After enabling the LDAP backend, logging in with a user of LDAP, removing the necessary group for login in LDAP and then removing the LDAP backend from Nextcloud causes the user to stay somehow in the system which causes flooding of the log with messages like this:

{
    "reqId": "azMwdqqlfa3Cmt6n1FhJ",
    "level": 3,
    "time": "2024-07-21T13:55:45+00:00",
    "remoteAddr": "",
    "user": "--",
    "app": "files",
    "method": "",
    "url": "--",
    "message": "Backends provided no user object for testuser_2438",
    "userAgent": "--",
    "version": "29.0.3.4",
    "exception": {
        "Exception": "OC\\User\\NoUserException",
        "Message": "Backends provided no user object",
        "Code": 0,
        "Trace": [
            {
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\Root",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php",
                "line": 84,
                "function": "call_user_func_array",
                "args": [
                    [
                        [
                            "OC\\Files\\Node\\Root"
                        ],
                        "getUserFolder"
                    ],
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyRoot.php",
                "line": 53,
                "function": "__call",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "getUserFolder",
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 558,
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\LazyRoot",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 577,
                "function": "getFileFromId",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "testuser_2438",
                    685035
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 1288,
                "function": "getFileFromIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 707,
                "function": "updateDirectoryContentIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php",
                "line": 314,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php",
                "line": 409,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Provider\\FilesProvider",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 109,
                "function": "updateDocument",
                "class": "OCA\\FullTextSearch\\Service\\IndexService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 77,
                "function": "liveCycle",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/Job.php",
                "line": 80,
                "function": "run",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": [
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 102,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 92,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/cron.php",
                "line": 177,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            }
        ],
        "File": "/var/www/html/lib/private/Files/Node/Root.php",
        "Line": 370,
        "message": "Backends provided no user object for testuser_2438",
        "exception": [],
        "CustomMessage": "Backends provided no user object for testuser_2438"
    },
    "id": "669d14ec6eb2b"
}

How do I get rid of this non-existing user testuser_2438?

Steps to reproduce

  1. Install Nextcloud AIO v9.2.0 (happend also with previous 9.x versions)
  2. Create a user called testuser and an arbitrary other user
  3. Participate in a Group Folder with the other user
  4. Share some files with the other user
  5. Install LLDAP (https://github.com/lldap/lldap) with ldaps-Support
  6. Enable the LDAP-Backend of Nextcloud
  7. Connect the Nextcloud LDAP backend to Nextcloud as decribed at https://github.com/lldap/lldap/blob/main/example_configs/nextcloud.md using ldaps
  8. Create a LDAP user called testuser
  9. log in with user testuser
  10. Wonder why there is a new user in addition to the existing testuser - with _<number> postfixed
  11. Realize the LDAP backend only works if installed from the very beginning without any user (from LDAP) being in the system
  12. Disable the LDAP backend
  13. Have a look at https://your-nextcloud-host/settings/users and you won't see the user mentioned in the error message
  14. Wait some time
  15. The logs will be flooded with error messages like "Backends provided no user object for testuser_2438"

Expected behavior

The really expected behaviour would be to join existing and ldap users as soon as Internal Username corresponds to the username and isn't UID.

After having learned the LDAP backend can't do it, the expected behavior is:
Deleting users deletes them really - no matter which backend added the user.

Installation method

Official All-in-One appliance

Nextcloud Server version

29

Operating system

RHEL/CentOS

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

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

Updated from a MINOR version (ex. 28.0.1 to 28.0.2)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "appsallowlist": false,
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "collab.itbh.at",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "collab.itbh.at"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "29.0.3.4",
        "overwrite.cli.url": "https:\/\/collab.itbh.at\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "loglevel": "2",
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": "10485760",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "enabledPreviewProviders": {
            "1": "OC\\Preview\\Image",
            "2": "OC\\Preview\\MarkDown",
            "3": "OC\\Preview\\MP3",
            "4": "OC\\Preview\\TXT",
            "5": "OC\\Preview\\OpenDocument",
            "6": "OC\\Preview\\Movie",
            "7": "OC\\Preview\\Krita",
            "0": "OC\\Preview\\Imaginary"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": "30",
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "updatedirectory": "\/nc-updater",
        "allow_local_remote_servers": true,
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": false,
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR"
        ],
        "default_phone_region": "AT",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance_window_start": 100,
        "preview_imaginary_key": "***REMOVED SENSITIVE VALUE***",
        "auth.bruteforce.protection.enabled": true,
        "ratelimit.protection.enabled": true,
        "app_install_overwrite": [
            "keeweb"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 2.21.1
  - admin_audit: 1.19.0
  - calendar: 4.7.12
  - circles: 29.0.0-dev
  - cloud_federation_api: 1.12.0
  - collectives: 2.12.0
  - comments: 1.19.0
  - contacts: 6.0.0
  - contactsinteraction: 1.10.0
  - dashboard: 7.9.0
  - dav: 1.30.1
  - deck: 1.13.1
  - drawio: 3.0.2
  - federatedfilesharing: 1.19.0
  - federation: 1.19.0
  - files: 2.1.0
  - files_antivirus: 5.5.7
  - files_downloadlimit: 2.0.0
  - files_external: 1.21.0
  - files_fulltextsearch: 29.0.0
  - files_pdfviewer: 2.10.0
  - files_reminders: 1.2.0
  - files_sharing: 1.21.0
  - files_trashbin: 1.19.0
  - files_versions: 1.22.0
  - files_zip: 1.5.0
  - firstrunwizard: 2.18.0
  - fulltextsearch: 29.0.0
  - fulltextsearch_elasticsearch: 29.0.1
  - groupfolders: 17.0.1
  - impersonate: 1.16.0
  - integration_google: 2.2.0
  - keeweb: 0.6.19
  - logreader: 2.14.0
  - lookup_server_connector: 1.17.0
  - mail: 3.7.5
  - nextcloud-aio: 0.6.0
  - nextcloud_announcements: 1.18.0
  - notes: 4.10.1
  - notifications: 2.17.0
  - notify_push: 0.6.12
  - oauth2: 1.17.0
  - password_policy: 1.19.0
  - photos: 2.5.0
  - privacy: 1.13.0
  - provisioning_api: 1.19.0
  - recommendations: 2.1.0
  - related_resources: 1.4.0
  - richdocuments: 8.4.3
  - serverinfo: 1.19.0
  - settings: 1.12.0
  - sharebymail: 1.19.0
  - spreed: 19.0.7
  - support: 1.12.0
  - survey_client: 1.17.0
  - systemtags: 1.19.0
  - text: 3.10.1
  - theming: 2.4.0
  - theming_customcss: 1.16.0
  - twofactor_backupcodes: 1.18.0
  - twofactor_totp: 11.0.0-dev
  - user_status: 1.9.0
  - viewer: 2.3.0
  - weather_status: 1.9.0
  - workflowengine: 2.11.0
Disabled:
  - analytics: 4.14.0 (installed 4.14.0)
  - bruteforcesettings: 2.9.0
  - encryption: 2.17.0
  - suspicious_login: 7.0.0 (installed 7.0.0)
  - tasks: 0.16.0 (installed 0.16.0)
  - user_ldap: 1.20.0 (installed 1.20.0)

Nextcloud Signing status

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
    - INVALID_HASH
        - core/js/mimetypelist.js
    - EXTRA_FILE
        - core/img/filetypes/dwb.svg
        - core/img/filetypes/drawio.svg

Raw output
==========
Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [core/js/mimetypelist.js] => Array
                        (
                            [expected] => 5b121122c0bec0580402c04605700056ee06eb553a4692bfc085ad3fc17aa49af43ca7795e98cbd22383020bfa9809bf3cc824b1673595f461479afb602bcec4
                            [current] => 3780abf2631567308dea2792113a813b71ed713c53769f4197a5e6205a4c2f1f6f6d84c8d58037e0a49b5148caf3be55276bf23f5e215e0e4d27cc8102c45b09
                        )

                )

            [EXTRA_FILE] => Array
                (
                    [core/img/filetypes/dwb.svg] => Array
                        (
                            [expected] => 
                            [current] => 43731dd5f17a048112ea5109b40b02ec019b3ee2324385a0f448e3bd2264cb13dc160ab018d893f92f8e2f168fd09009b51578c8c6b97a02a1617c67ac087701
                        )

                    [core/img/filetypes/drawio.svg] => Array
                        (
                            [expected] => 
                            [current] => 92e0974cf869bf8ab969c3442dc2b80d55fde36441d22924db74916a06b407520aa2a9dc39336f9157195ebede697ffac0e639360879255ab91932d406e1897d
                        )

                )

        )

)

Nextcloud Logs

{
    "reqId": "DsNVbZXwn6idJXPzewgp",
    "level": 3,
    "time": "2024-07-21T14:10:46+00:00",
    "remoteAddr": "",
    "user": "--",
    "app": "files",
    "method": "",
    "url": "--",
    "message": "Backends provided no user object for testuser_2438",
    "userAgent": "--",
    "version": "29.0.3.4",
    "exception": {
        "Exception": "OC\\User\\NoUserException",
        "Message": "Backends provided no user object",
        "Code": 0,
        "Trace": [
            {
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\Root",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php",
                "line": 84,
                "function": "call_user_func_array",
                "args": [
                    [
                        [
                            "OC\\Files\\Node\\Root"
                        ],
                        "getUserFolder"
                    ],
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyRoot.php",
                "line": 53,
                "function": "__call",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "getUserFolder",
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 558,
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\LazyRoot",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 577,
                "function": "getFileFromId",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "testuser_2438",
                    685035
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 1288,
                "function": "getFileFromIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 707,
                "function": "updateDirectoryContentIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php",
                "line": 314,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php",
                "line": 409,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Provider\\FilesProvider",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 109,
                "function": "updateDocument",
                "class": "OCA\\FullTextSearch\\Service\\IndexService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 77,
                "function": "liveCycle",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/Job.php",
                "line": 80,
                "function": "run",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": [
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 102,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 92,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/cron.php",
                "line": 177,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            }
        ],
        "File": "/var/www/html/lib/private/Files/Node/Root.php",
        "Line": 370,
        "message": "Backends provided no user object for testuser_2438",
        "exception": [],
        "CustomMessage": "Backends provided no user object for testuser_2438"
    },
    "id": "669d18a4745f0"
}

Additional info

No response

solracsf commented 4 months ago

For LDAP remnants, see: https://docs.nextcloud.com/server/29/admin_manual/configuration_user/user_auth_ldap_cleanup.html

cdhermann commented 4 months ago

For LDAP remnants, see: https://docs.nextcloud.com/server/29/admin_manual/configuration_user/user_auth_ldap_cleanup.html

Thank you very much for the link, but unfortunately the ldap:show-remnants command displays nothing:

# docker exec -ti --user www-data nextcloud-aio-nextcloud /var/www/html/occ config:app:get user_ldap ldapUserCleanupInterval
51
# docker exec -ti --user www-data nextcloud-aio-nextcloud /var/www/html/occ ldap:show-remnants
+----------------+--------------+----------+---------+------------+-------------+-----+--------+
| Nextcloud name | Display Name | LDAP UID | LDAP DN | Last Login | Detected on | Dir | Sharer |
+----------------+--------------+----------+---------+------------+-------------+-----+--------+
cdhermann commented 3 months ago

How do I find the records in the DB causing this error messages? Maybe deleting or updating the records triggering the message in the DB directly helps getting rid of these recurring messages for non-existing users.

Sometimes the object is referred to with an UUID, sometimes with username the user had as it existed.

{
    "reqId": "Q0IhgQoDCJfqvAhVTJGs",
    "level": 3,
    "time": "2024-08-06T07:15:14+00:00",
    "remoteAddr": "",
    "user": "--",
    "app": "files",
    "method": "",
    "url": "--",
    "message": "Backends provided no user object for e8b29d14-908f-38c4-95cc-7be0743aa89c",
    "userAgent": "--",
    "version": "29.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": "->",
                "args": [
                    "e8b29d14-908f-38c4-95cc-7be0743aa89c"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php",
                "line": 84,
                "function": "call_user_func_array",
                "args": [
                    [
                        [
                            "OC\\Files\\Node\\Root"
                        ],
                        "getUserFolder"
                    ],
                    [
                        "e8b29d14-908f-38c4-95cc-7be0743aa89c"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyRoot.php",
                "line": 53,
                "function": "__call",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "getUserFolder",
                    [
                        "e8b29d14-908f-38c4-95cc-7be0743aa89c"
                    ]
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 558,
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\LazyRoot",
                "type": "->",
                "args": [
                    "e8b29d14-908f-38c4-95cc-7be0743aa89c"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 577,
                "function": "getFileFromId",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "e8b29d14-908f-38c4-95cc-7be0743aa89c",
                    684249
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 638,
                "function": "getFileFromIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 706,
                "function": "generateDocumentFromIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php",
                "line": 314,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php",
                "line": 409,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Provider\\FilesProvider",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 109,
                "function": "updateDocument",
                "class": "OCA\\FullTextSearch\\Service\\IndexService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 77,
                "function": "liveCycle",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/Job.php",
                "line": 80,
                "function": "run",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": [
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 102,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 92,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/cron.php",
                "line": 177,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            }
        ],
        "File": "/var/www/html/lib/private/Files/Node/Root.php",
        "Line": 370,
        "message": "Backends provided no user object for e8b29d14-908f-38c4-95cc-7be0743aa89c",
        "exception": [],
        "CustomMessage": "Backends provided no user object for e8b29d14-908f-38c4-95cc-7be0743aa89c"
    },
    "id": "66b1cebde62d2"
}
roelofz commented 6 days ago

@joshtrichards is there any progress on this topic, or where can I follow the progress, maybe even contribute by adding information? Thanks!

caguiar commented 4 days ago

Hi,

I have a similar situation, where the log is getting inundated with the "NoUserException Backends provided no user object" error message.

The user in question was an LDAP user, which was deleted from LDAP, and then deleted from Nextcloud, as per the manual https://docs.nextcloud.com/server/29/admin_manual/configuration_user/user_auth_ldap_cleanup.html.

At present the command ldap:show-remnants command displays nothing.

How can I solve this?

joshtrichards commented 4 days ago

@roelofz & @caguiar Are you both also using the files_fulltextsearch app? That is where OP's stack trace is coming from.

caguiar commented 4 days ago

Yes I do have files_fulltextsearch app installed, and seems that is where the error is comming from.

{ "reqId": "HntkzuoMUt7Jsru8EXKo", "level": 3, "time": "2024-11-18T19:05:04+00:00", "remoteAddr": "", "user": "--", "app": "files", "method": "", "url": "--", "message": "Backends provided no user object for 1CB07EF3-6076-45EA-8498-04ADF9980029", "userAgent": "--", "version": "30.0.2.2", "exception": { "Exception": "OC\User\NoUserException", "Message": "Backends provided no user object", "Code": 0, "Trace": [ { "function": "getUserFolder", "class": "OC\Files\Node\Root", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Files/Node/LazyFolder.php", "line": 64, "function": "call_user_func_array" }, { "file": "/var/www/nextcloud/lib/private/Files/Node/LazyRoot.php", "line": 38, "function": "__call", "class": "OC\Files\Node\LazyFolder", "type": "->" }, { "file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php", "line": 558, "function": "getUserFolder", "class": "OC\Files\Node\LazyRoot", "type": "->" }, { "file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php", "line": 577, "function": "getFileFromId", "class": "OCA\Files_FullTextSearch\Service\FilesService", "type": "->" }, { "file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php", "line": 638, "function": "getFileFromIndex", "class": "OCA\Files_FullTextSearch\Service\FilesService", "type": "->" }, { "file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php", "line": 706, "function": "generateDocumentFromIndex", "class": "OCA\Files_FullTextSearch\Service\FilesService", "type": "->" }, { "file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php", "line": 314, "function": "updateDocument", "class": "OCA\Files_FullTextSearch\Service\FilesService", "type": "->", "args": [ " sensitive parameters replaced " ] }, { "file": "/var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php", "line": 409, "function": "updateDocument", "class": "OCA\Files_FullTextSearch\Provider\FilesProvider", "type": "->", "args": [ " sensitive parameters replaced " ] }, { "file": "/var/www/nextcloud/apps/fulltextsearch/lib/Cron/Index.php", "line": 109, "function": "updateDocument", "class": "OCA\FullTextSearch\Service\IndexService", "type": "->", "args": [ " sensitive parameters replaced " ] }, { "file": "/var/www/nextcloud/apps/fulltextsearch/lib/Cron/Index.php", "line": 77, "function": "liveCycle", "class": "OCA\FullTextSearch\Cron\Index", "type": "->" }, { "file": "/var/www/nextcloud/lib/public/BackgroundJob/Job.php", "line": 61, "function": "run", "class": "OCA\FullTextSearch\Cron\Index", "type": "->" }, { "file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php", "line": 83, "function": "start", "class": "OCP\BackgroundJob\Job", "type": "->" }, { "file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php", "line": 73, "function": "start", "class": "OCP\BackgroundJob\TimedJob", "type": "->" }, { "file": "/var/www/nextcloud/cron.php", "line": 162, "function": "execute", "class": "OCP\BackgroundJob\TimedJob", "type": "->" } ], "File": "/var/www/nextcloud/lib/private/Files/Node/Root.php", "Line": 345, "message": "Backends provided no user object for 1CB07EF3-6076-45EA-8498-04ADF9980029", "exception": [], "CustomMessage": "Backends provided no user object for 1CB07EF3-6076-45EA-8498-04ADF9980029" }, "id": "673b9237ad590" }

joshtrichards commented 4 days ago

FTS may need a similar fix as nextcloud/server#41786 made for files_versions. Though I haven't looked at the actual code in FTS yet.

roelofz commented 4 days ago

Yes I do have files_fulltextsearch app installed, and seems that is where the error is comming from.

I also have this app installed, but do not see why this app in the report stands out more then others (just being curious)? Can you show me why it stands out between the other php's?

Second, this app is not to be trusted @joshtrichards ? I mean it is not maintained by Nextcloud personnel and therefore a higher risk of incompatibilities?

Last, it was very difficult to find the source of this problem, how can I help for users simular to me, looking for answers?

Thanks both for the earlier and future responses!

Roelof

roelofz commented 3 days ago

Ehh, what am I doing wrong?

`user@nas:/opt/nextcloud# ./ncocc.sh app:enable files_fulltextsearch files_fulltextsearch 30.0.0 enabled user@nas:/opt/nextcloud# ./ncocc.sh app:remove files_fulltextsearch files_fulltextsearch disabled files_fulltextsearch 30.0.0 removed user@nas:/opt/nextcloud# ./ncocc.sh app:list | grep files_fulltextsearch user@nas:/opt/nextcloud# docker restart nextcloud-aio-nextcloud nextcloud-aio-nextcloud user@nas:/opt/nextcloud# ./ncocc.sh app:list | grep files_fulltextsearch

0-wHiTeHand-0 commented 3 days ago

Hi everyone, I had the same anoying issue after removing a local user (no LDAP, just a normal user). Yesterday I reset fulltextsearch and then re-indexed, and it's no longer occurring:

php occ fulltextsearch:reset
php occ fulltextsearch:index

My Nextcloud instance has 4 users, so not a lot of files. Be careful on large instances.

joshtrichards commented 3 days ago

Unverified take: It seems we need to either:

There is already a listener for when files are deleted AFAIK. I would have expected this would catch these situations (once the user's files after account removal), but maybe not.

roelofz commented 3 days ago

Reindexing now, big thanks for that, seems a logical solution, my setup is also small (but I like to think enterprise-like, so this is not the best workaround).

joshtrichards commented 6 hours ago

nextcloud/server#47896 might be relevant here.