nextcloud / nextcloud/server

[Bug]: When running repair steps for the first time, changed classes get not loaded properly

Open
#38,158 15 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop feature: apps management feature: install and update feature: occ high technical debt
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.
Bug description

When updating an app (here it is Polls) via occ it seems that altered classes, which are used inside a repair step get not updated properly (caching??). A second update run then installs the app with out an exception.

Steps to reproduce

See details here: https://github.com/nextcloud/polls/issues/2900 and https://github.com/nextcloud/polls/issues/2793

Expected behavior

changed classes should be loaded properly while updating an app.

Installation method

Community Web installer on a VPS or web space

Nextcloud Server version

26

Operating system

None

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MySQL

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

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "test.yagst.de"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "tempdirectory": "\/tmp\/nextcloud",
        "dbtype": "mysql",
        "version": "26.0.1.1",
        "overwrite.cli.url": "http:\/\/xxx",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "theme": "",
        "loglevel": 0,
        "maintenance": false,
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "app_install_overwrite": [
            "polls"
        ]
    }
}
List of activated Apps
Enabled:
  - activity: 2.18.0
  - admin_audit: 1.16.0
  - bruteforcesettings: 2.6.0
  - circles: 26.0.0
  - cloud_federation_api: 1.9.0
  - comments: 1.16.0
  - contactsinteraction: 1.7.0
  - dashboard: 7.6.0
  - dav: 1.25.0
  - federatedfilesharing: 1.16.0
  - federation: 1.16.0
  - files: 1.21.1
  - files_external: 1.18.0
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - nextcloud_announcements: 1.15.0
  - notifications: 2.14.0
  - oauth2: 1.14.0
  - password_policy: 1.16.0
  - photos: 2.2.0
  - polls: 5.0.5
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - support: 1.9.0
  - survey_client: 1.14.0
  - systemtags: 1.16.0
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - user_ldap: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - weather_status: 1.6.0
  - workflowengine: 2.8.0
Disabled:
  - encryption: 2.14.0 (installed 2.8.1)
  - suspicious_login: 4.4.0
  - twofactor_totp: 8.0.0-alpha.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
		- .user.ini

Raw output
==========
Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [.user.ini] => Array
                        (
                            [expected] => 4843b3217e91f8536cb9b52700efb20300290292cf6286f92794d4cec99df286afeb7dd6c91b1be20bc55eda541eef230a5c5e7dcd46c189edd0ed1e80c6d3f5
                            [current] => 3fecf59adb63f3529c30449b25264e1fd2a447b855afae05821110b50039a5e51f6c4f3349399512602b5544a65cdf6fa3c50b81f16fcbe2e0be175d9f6c4c82
                        )

                )

        )

)
Nextcloud Logs
sudo -u www-data php8.1 ./occ app:update --all
polls new version available: 5.0.5
An unhandled exception has been thrown:
Error: Call to undefined method OCA\Polls\Db\TableManager::deleteAllDuplicates() in /var/www/nc_01/nextcloud/apps/polls/lib/Migration/RepairSteps/DeleteInvalidRecords.php:70
Stack trace:
#0 /var/www/nc_01/nextcloud/lib/private/Repair.php(127): OCA\Polls\Migration\RepairSteps\DeleteInvalidRecords->run()
#1 /var/www/nc_01/nextcloud/lib/private/legacy/OC_App.php(1068): OC\Repair->run()
#2 /var/www/nc_01/nextcloud/lib/private/legacy/OC_App.php(1005): OC_App::executeRepairSteps()
#3 /var/www/nc_01/nextcloud/lib/private/Installer.php(200): OC_App::updateApp()
#4 /var/www/nc_01/nextcloud/core/Command/App/Update.php(107): OC\Installer->updateAppstoreApp()
#5 /var/www/nc_01/nextcloud/apps/recognize/vendor/symfony/console/Command/Command.php(298): OC\Core\Command\App\Update->execute()
#6 /var/www/nc_01/nextcloud/apps/recognize/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#7 /var/www/nc_01/nextcloud/apps/recognize/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#8 /var/www/nc_01/nextcloud/apps/recognize/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#9 /var/www/nc_01/nextcloud/lib/private/Console/Application.php(214): Symfony\Component\Console\Application->run()
#10 /var/www/nc_01/nextcloud/console.php(100): OC\Console\Application->run()
#11 /var/www/nc_01/nextcloud/occ(11): require_once('...')
#12 {main}
Additional info

The method OCA\Polls\Db\TableManager::deleteAllDuplicates() was added in the last Polls version (5.0.5).

The error trace is taken from https://github.com/nextcloud/polls/issues/2900
The system configuration is taken from my test instance, where I could observe this problem too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/private/Installer.php and lib/private/Repair.php, following OC_App::updateApp() and executeRepairSteps() in lib/private/legacy/OC_App.php. Reproduce the occ app:update --all failure and inspect how repair steps load changed app classes, including the Polls TableManager method. Done means the first update run completes without the undefined-method exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.