nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.76k stars 4k forks source link

RuntimeException: "There can only be one Talk backend" on upgrade #34919

Open AndyXheli opened 1 year ago

AndyXheli commented 1 year ago

How to use GitHub


Steps to reproduce

1.Upgraded from NC 24.0.6 to NC 25.0.1 RC1

Browser log

``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```

Server configuration

Operating system: Ubuntu/RedHat/... Ubuntu 22.0.4 Web server: Apache/Nginx Apache2 Database: MySQL/Maria/SQLite/PostgreSQL MariaDb PHP version: 7.4/8.0/8.1 8.1 Nextcloud Version: (see admin page) 25.0.1 RC1

Server log (data/nextcloud.log)

``` {"reqId":"566XT8kErR6NkBz75Stl","level":4,"time":"2022-10-27T15:35:44-05:00","remoteAddr":"","user":"--","app":"spreed","method":"","url":"--","message":"Error during app service registration: There can only be one Talk backend","userAgent":"--","version":"24.0.6.1","exception":{"Exception":"RuntimeException","Message":"There can only be one Talk backend","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/RegistrationContext.php","line":296,"function":"registerTalkBackend","class":"OC\\AppFramework\\Bootstrap\\RegistrationContext","type":"->"},{"file":"/var/www/nextcloud/apps/spreed/lib/AppInfo/Application.php","line":143,"function":"registerTalkBackend","class":"OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous\u0000/var/www/nextcloud/lib/private/AppFramework/Bootstrap/RegistrationContext.php:142$4b","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":136,"function":"register","class":"OCA\\Talk\\AppInfo\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":95,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Installer.php","line":143,"function":"runLazyRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":442,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":432,"function":"enable","class":"OC_App","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":285,"function":"upgradeAppStoreApps","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":141,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/core/Command/Upgrade.php","line":225,"function":"upgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1009,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":273,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":149,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/RegistrationContext.php","Line":432,"message":"Error during app service registration: There can only be one Talk backend","exception":[],"CustomMessage":"Error during app service registration: There can only be one Talk backend"},"id":"635aed9472e64"} ```
nickvergessen commented 1 year ago

cc @ChristophWurst Seems like apps are loaded/registered twice in the upgrade process, so the backend seems to be registered twice at the end.

The registerCalendarResourceBackend and registerCalendarRoomBackend also don't have such a check in place but simply overwrite it. Should be okay to do it for Talk too?

https://github.com/nextcloud/server/blob/68d0038eb0012ef908e7d2c23ec9a724baf820d2/lib/private/AppFramework/Bootstrap/RegistrationContext.php#L423-L450

ChristophWurst commented 1 year ago

The registerCalendarResourceBackend and registerCalendarRoomBackend also don't have such a check in place but simply overwrite it.

For them we want to allow more than one. Hence the registration methods append to an array. For Talk we only expect to find one backend.

Do you have a clue why apps register twice? That is what we have to fix

micdoug commented 1 year ago

Were you able to solve this? I added a cron task on the host machine (since I am running nextcloud-aio on docker) to install the spreed app at each reboot to solve it temporarily.

@reboot /storage/homelab/system/nextcloud/enable_talk.sh

The enable_talk.sh:

#!/bin/bash

# This script is a temporary fix to enable the talk plugin in each server restart until the bug is fixed
sleep 300  # wait for container to startup
docker exec --user www-data nextcloud-aio-nextcloud php /var/www/html/occ app:install spreed
AndyXheli commented 1 year ago

Issue appeared on NC 26.0.0 upgrade

{"reqId":"nb3JjdGk8Dj0Qo2wrxAA","level":4,"time":"2023-03-21T10:11:34-05:00","remoteAddr":"1.1.1.1","user":"--","app":"spreed","method":"GET","url":"/core/ajax/update.php?requesttoken=SBjPlIsE1n6y%2F4XgNUqdzHkygwqOfGP%2FVniaaPH8xkI%3D%3AIWzgrblV7gbUtumxAC7WhBZWs2bhMhDPYkirErmXoTA%3D","message":"Error during app service registration: There can only be one Talk backend","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","version":"25.0.4.1","exception":{"Exception":"RuntimeException","Message":"There can only be one Talk backend","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/RegistrationContext.php","line":314,"function":"registerTalkBackend","class":"OC\\AppFramework\\Bootstrap\\RegistrationContext","type":"->"},{"file":"/var/www/nextcloud/apps/spreed/lib/AppInfo/Application.php","line":153,"function":"registerTalkBackend","class":"OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous\u0000/var/www/nextcloud/lib/private/AppFramework/Bootstrap/RegistrationContext.php:152$1cb","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":142,"function":"register","class":"OCA\\Talk\\AppInfo\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":94,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Installer.php","line":143,"function":"runLazyRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":451,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":431,"function":"enable","class":"OC_App","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":284,"function":"upgradeAppStoreApps","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/core/ajax/update.php","line":185,"function":"upgrade","class":"OC\\Updater","type":"->"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/RegistrationContext.php","Line":461,"message":"Error during app service registration: There can only be one Talk backend","exception":[],"CustomMessage":"Error during app service registration: There can only be one Talk backend"},"id":"64234832c85eb"}
AndyXheli commented 1 year ago

Also happen on NC 27

nebulade commented 8 months ago

I also just hit this now with nextcloud 28. It only appears to be happening when the spreed/talk app is installed via the occ cli tool via occ app:install spreed Installing it via the appstore UI does not trigger that issue.

vgdh commented 2 months ago

I also just hit this now with nextcloud 29

melroy89 commented 4 days ago

I just hit the same issue with Nextcloud 30 as well yesterday..

Yes the spreed (aka Talk) application was and is still enabled. For now I only saw it twice, once in 16 May 2024. And now yesterday again after Nextcloud 30 upgrade