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

with external storage, cron throws error Typed property OC\FullTextSearch\Model\IndexDocument::$access must not be accessed before initialization #298

Open
afflux opened this issue Jan 3, 2025 · 1 comment

Comments

@afflux
Copy link

afflux commented Jan 3, 2025

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. enable external storage
  2. mount external storage
  3. External Files setting set to "Index path only"
  4. wait for cron to run

Expected behaviour

Indexing works, no errors in NC log

Actual behaviour

    "exception": {
        "Exception": "Error",
        "Message": "Typed property OC\\FullTextSearch\\Model\\IndexDocument::$access must not be accessed before initialization",
        "Code": 0,
        "Trace": [
            {
                "function": "jsonSerialize",
                "class": "OC\\FullTextSearch\\Model\\IndexDocument",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/vendor/artificial-owl/my-small-php-tools/lib/Traits/Nextcloud/nc22/TNC22Logger.php",
                "line": 192,
                "function": "json_encode",
                "args": [
                    {
                        "index": "*** sensitive parameters replaced ***",
                        "document": {
                            "__class__": "OCA\\Files_FullTextSearch\\Model\\FilesDocument"
                        }
                    }
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/vendor/artificial-owl/my-small-php-tools/lib/Traits/Nextcloud/nc22/TNC22Logger.php",
                "line": 177,
                "function": "log",
                "class": "OCA\\Files_FullTextSearch\\Provider\\FilesProvider",
                "type": "->",
                "args": [
                    0,
                    "[debug] updateDocument result",
                    false,
                    {
                        "index": "*** sensitive parameters replaced ***",
                        "document": {
                            "__class__": "OCA\\Files_FullTextSearch\\Model\\FilesDocument"
                        }
                    }
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php",
                "line": 315,
                "function": "debug",
                "class": "OCA\\Files_FullTextSearch\\Provider\\FilesProvider",
                "type": "->",
                "args": [
                    "[debug] updateDocument result",
                    {
                        "index": "*** sensitive parameters replaced ***",
                        "document": {
                            "__class__": "OCA\\Files_FullTextSearch\\Model\\FilesDocument"
                        }
                    }
                ]
            },
            {
                "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": 61,
                "function": "run",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": [
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 88,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->",
                "args": [
                    {
                        "__class__": "OC\\BackgroundJob\\JobList"
                    }
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 75,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    {
                        "__class__": "OC\\BackgroundJob\\JobList"
                    }
                ]
            },
            {
                "file": "/var/www/html/cron.php",
                "line": 162,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    {
                        "__class__": "OC\\BackgroundJob\\JobList"
                    }
                ]
            }
        ],
        "File": "/var/www/html/lib/private/FullTextSearch/Model/IndexDocument.php",
        "Line": 757,
        "message": "exception encountered while running fulltextsearch/lib/Cron/Index.php",
        "exception": {},
        "CustomMessage": "exception encountered while running fulltextsearch/lib/Cron/Index.php"
    }

Server configuration

Web server: Nginx

Database: Maria

PHP version: 8.2

Nextcloud version: 30.0.4

List of activated apps
Enabled:
  - activity: 3.0.0
  - app_api: 4.0.3
  - bruteforcesettings: 3.0.0
  - calendar: 5.0.8
  - cloud_federation_api: 1.13.0
  - contacts: 6.1.2
  - contactsinteraction: 1.11.0
  - cookbook: 0.11.2
  - dav: 1.31.1
  - federatedfilesharing: 1.20.0
  - federation: 1.20.0
  - files: 2.2.0
  - files_downloadlimit: 3.0.0
  - files_external: 1.22.0
  - files_fulltextsearch: 30.0.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - firstrunwizard: 3.0.0
  - forms: 4.3.4
  - fulltextsearch: 30.0.0
  - fulltextsearch_elasticsearch: 30.0.0
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - notes: 4.11.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - password_policy: 2.0.0
  - photos: 3.0.2
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - recommendations: 3.0.0
  - related_resources: 1.5.0
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - support: 2.0.0
  - systemtags: 1.20.0
  - tasks: 0.16.1
  - text: 4.1.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - twofactor_webauthn: 2.0.0
  - updatenotification: 1.20.0
  - viewer: 3.0.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - admin_audit: 1.20.0
  - circles: 30.0.0 (installed 23.0.0)
  - comments: 1.20.1 (installed 1.19.0)
  - dashboard: 7.10.0 (installed 7.3.0)
  - encryption: 2.18.0 (installed 2.11.0)
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - nextcloud_announcements: 2.0.0 (installed 1.18.0)
  - survey_client: 2.0.0 (installed 1.11.0)
  - suspicious_login: 8.0.0
  - twofactor_nextcloud_notification: 4.0.0
  - twofactor_totp: 12.0.0-dev
  - user_ldap: 1.21.0
  - user_status: 1.10.0 (installed 1.9.0)
  - weather_status: 1.10.0 (installed 1.9.0)
Nextcloud configuration
{
    "system": {
        "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
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "DOMAIN"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "30.0.4.1",
        "overwrite.cli.url": "https:\/\/DOMAIN",
        "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": "smtp",
        "mail_sendmailmode": "smtp",
        "default_phone_region": "DE",
        "mail_smtpsecure": "ssl",
        "maintenance": false,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "PLAIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 60",
        "loglevel": 1,
        "app_install_overwrite": [
            "cookbook",
            "fulltextsearch",
            "fulltextsearch_elasticsearch",
            "files_fulltextsearch",
            "tasks",
            "forms"
        ],
        "theme": "",
        "maintenance_window_start": 1
    }
}

Browser

cron issue - no browser in use

@afflux
Copy link
Author

afflux commented Jan 3, 2025

I believe this is caused by this code path returning a document with uninitialized $access:

$index->setStatus(IIndex::INDEX_REMOVE);
$document = new FilesDocument($index->getProviderId(), $index->getDocumentId());
$document->setIndex($index);
return $document;

Which is subsequently logged here:

$this->debug('updateDocument result', ['index' => $index, 'document' => $document]);

Triggering this uninitialized access:
https://github.com/nextcloud/server/blob/f82ff164c3029c9b5a6c095563aff3b6b06cc438/lib/private/FullTextSearch/Model/IndexDocument.php#L757

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

No branches or pull requests

1 participant