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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndyXheli opened this issue Oct 27, 2022 · 6 comments
Open

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

AndyXheli opened this issue Oct 27, 2022 · 6 comments
Labels

Comments

@AndyXheli
Copy link
Contributor

AndyXheli commented Oct 27, 2022

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.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"}
@AndyXheli AndyXheli added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Oct 27, 2022
@nickvergessen nickvergessen changed the title RuntimeException: There can only be one Talk backend RuntimeException: "There can only be one Talk backend" on upgrade Nov 2, 2022
@nickvergessen nickvergessen transferred this issue from nextcloud/spreed Nov 2, 2022
@nickvergessen
Copy link
Member

nickvergessen commented Nov 2, 2022

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?

/**
* @psalm-param class-string<ITalkBackend> $backend
*/
public function registerTalkBackend(string $appId, string $backend) {
// Some safeguards for invalid registrations
if ($appId !== 'spreed') {
throw new RuntimeException("Only the Talk app is allowed to register a Talk backend");
}
if ($this->talkBackendRegistration !== null) {
throw new RuntimeException("There can only be one Talk backend");
}
$this->talkBackendRegistration = new ServiceRegistration($appId, $backend);
}
public function registerCalendarResourceBackend(string $appId, string $class) {
$this->calendarResourceBackendRegistrations[] = new ServiceRegistration(
$appId,
$class,
);
}
public function registerCalendarRoomBackend(string $appId, string $class) {
$this->calendarRoomBackendRegistrations[] = new ServiceRegistration(
$appId,
$class,
);
}

@ChristophWurst
Copy link
Member

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
Copy link

micdoug commented Mar 12, 2023

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
Copy link
Contributor Author

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
Copy link
Contributor Author

Also happen on NC 27

@nebulade
Copy link

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.

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

No branches or pull requests

7 participants