Closed theyoungstone closed 3 months ago
If I toggle the background job type on my test system (Nextcloud 29, updated over years including beta and RC versions) using the CLI
sudo -u apache php /var/www/public_html/nextcloud.domain.tld/occ background:ajax
then this error occurs:
In AppConfig.php line 821:
conflict between new type (mixed) and old type (string)
This error does not occur in a productive system (version 29, updated over years excluding beta and RC versions, no fresh install). I assume that a database entry may be out of date.
Can confirm the same issue here on my NC29.0.1 instance:
root@vm1:~# sudo -u www-data php /var/www/occ background:webcron
In AppConfig.php line 821:
conflict between new type (mixed) and old type (string)
background:webcron
root@vm1:~# sudo -u www-data php /var/www/occ background:ajax
In AppConfig.php line 821:
conflict between new type (mixed) and old type (string)
background:ajax
root@vm1:~# sudo -u www-data php /var/www/occ background:cron
Set mode for background jobs to 'cron'
root@vm1:~#
Thanks for reporting.
Looks possibly related to changes made in PR #41755 that typed the values.
Not a PR or area of code I'm at all familiar with, but some clues in case someone feels like taking a closer look.
Same issue here
Same here too. Additional info: if I run ./occ background:webcron
to change it, I get:
In AppConfig.php line 821:
conflict between new type (mixed) and old type (string)
background:webcron
Seeing this too.
Same here.
Same here.
I updated to the latest version of Nextcloud yesterday and it seemed to solve my problem with cron not working and also not being able to switch cron types.
Same here.
I updated to the latest version of Nextcloud yesterday and it seemed to solve my problem with cron not working and also not being able to switch cron types.
Nextcloud up to date (stable version : Nextcloud Hub 8 (29.0.2)) and not solved.
Ditto on above
Same issue here:
php occ background:ajax
results in
In AppConfig.php line 821:
conflict between new type (mixed) and old type (string)
background:ajax
just updated from 28.0.5 --> 29.0.2
And still happening on 29.0.3:(
Rather than posting "me too" comments, upvote :+1: the initial report above, unless you have some new information to add.
It just spams everybody and wastes developer time needed to fix bugs. Thanks!
P.S. This is a known issue (reproduced). That's why I labeled it 1. to develop last week. :)
As a workaround, for the time being to toggle the background mode, you should be able to change the value directly:
occ config:app:set --value cron --type string core backgroundjobs_mode
Where cron
is one of { cron, webcron, ajax }
.
It's also possible to force it to be mixed, but I'm hesitant to suggest changing that since I'm not sure what's actually going on here and I still have yet to wrap my head around #41755, the migration path, what the expected behavior was here (other than obviously not breaking the ability to set the background mode).
https://github.com/nextcloud/server/blob/00aa8f543841c6bfd853a3ac5cb4ff3ab0a058ae/cron.php#L109-L111
We are using the new IAppConfig api in cron.php. That means if cron.php was called once, and the backgroundjobs_mode was not already set to cron, it's then changed to cron AND type is set from 2 (mixed) to 4 (string).
When the value was typed once, it's not possible to set a new value without giving a type. Unfortunatly , the commands and provisioning_api are using the old IAppConfig api which uses type mixed.
Pull request for the commands: https://github.com/nextcloud/server/pull/46185
The provisioning_api also needs an update to use the types.
Needs some input from @ArtificialOwl.
The provisioning_api also needs an update to use the types.
The final version should support all types, but the patch below made it work again.
Index: apps/provisioning_api/lib/Controller/AppConfigController.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/apps/provisioning_api/lib/Controller/AppConfigController.php b/apps/provisioning_api/lib/Controller/AppConfigController.php
--- a/apps/provisioning_api/lib/Controller/AppConfigController.php (revision f6e95d3aec5eb3482891b7ebcd64d6676947d448)
+++ b/apps/provisioning_api/lib/Controller/AppConfigController.php (date 1719519354804)
@@ -107,7 +107,7 @@
* 200: Value updated successfully
* 403: App or key is not allowed
*/
- public function setValue(string $app, string $key, string $value): DataResponse {
+ public function setValue(string $app, string $key, string $value, int $type = IAppConfig::VALUE_MIXED): DataResponse {
$user = $this->userSession->getUser();
if ($user === null) {
throw new \Exception("User is not logged in."); // Should not happen, since method is guarded by middleware
@@ -124,8 +124,13 @@
return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
}
- /** @psalm-suppress InternalMethod */
- $this->appConfig->setValueMixed($app, $key, $value);
+ if ($type === IAppConfig::VALUE_STRING) {
+ $this->appConfig->setValueString($app, $key, $value);
+ } else {
+ /** @psalm-suppress InternalMethod */
+ $this->appConfig->setValueMixed($app, $key, $value);
+ }
+
return new DataResponse();
}
Index: apps/settings/src/components/BasicSettings/BackgroundJob.vue
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/apps/settings/src/components/BasicSettings/BackgroundJob.vue b/apps/settings/src/components/BasicSettings/BackgroundJob.vue
--- a/apps/settings/src/components/BasicSettings/BackgroundJob.vue (revision f6e95d3aec5eb3482891b7ebcd64d6676947d448)
+++ b/apps/settings/src/components/BasicSettings/BackgroundJob.vue (date 1719519482717)
@@ -125,7 +125,7 @@
},
methods: {
async onBackgroundJobModeChanged(backgroundJobsMode) {
- const url = generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/{appId}/{key}', {
+ const url = generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/{appId}/{key}?type=4', {
appId: 'core',
key: 'backgroundjobs_mode',
})
Hello,
I am using crazy-max's nextcloud image and was upgrading from 28.0.1
to 29.0.3
and am facing this database problem after performing the upgrade. Is it related please?
nextcloud.postgres |
nextcloud.postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization
nextcloud.postgres |
nextcloud.postgres | 2024-07-27 20:31:25.050 UTC [1] LOG: starting PostgreSQL 12.19 (Debian 12.19-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
nextcloud.postgres | 2024-07-27 20:31:25.060 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
nextcloud.postgres | 2024-07-27 20:31:25.060 UTC [1] LOG: listening on IPv6 address "::", port 5432
nextcloud.postgres | 2024-07-27 20:31:25.063 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
nextcloud.postgres | 2024-07-27 20:31:25.070 UTC [26] LOG: database system was shut down at 2024-07-27 11:14:09 UTC
nextcloud.postgres | 2024-07-27 20:31:25.079 UTC [1] LOG: database system is ready to accept connections
nextcloud.postgres | 2024-07-27 20:31:25.983 UTC [34] ERROR: column "type" does not exist at character 45
nextcloud.postgres | 2024-07-27 20:31:25.983 UTC [34] STATEMENT: SELECT "appid", "configkey", "configvalue", "type" FROM "appconfig" WHERE "lazy" = $1
nextcloud.postgres | 2024-07-27 20:31:26.323 UTC [38] ERROR: column "type" does not exist at character 45
nextcloud.postgres | 2024-07-27 20:31:26.323 UTC [38] STATEMENT: SELECT "appid", "configkey", "configvalue", "type" FROM "appconfig" WHERE "lazy" = $1
nextcloud.postgres | 2024-07-27 20:31:26.332 UTC [39] ERROR: column "type" does not exist at character 45
nextcloud.postgres | 2024-07-27 20:31:26.332 UTC [39] STATEMENT: SELECT "appid", "configkey", "configvalue", "type" FROM "appconfig" WHERE "lazy" = $1
If so how to use your workaround from above?
I tried and it did not work:
root@caradhras:[/docker/nextcloud]: docker-compose exec --user nextcloud nextcloud php occ config:app:set --value cron --type string core backgroundjobs_mode
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
You are about to set config value core/backgroundjobs_mode as STRING
This might break thing, affect performance on your instance or its security!
Confirm this action by typing 'yes': yes
done
In DbalException.php line 71:
An exception occurred while executing a query: SQLSTATE[42703]: Undefined column: 7 ERROR: column "type" of relation "appconfig" does not exist
LINE 1: UPDATE "appconfig" SET "type" = $1 WHERE ("appid" = $2) AND ...
^
In ExceptionConverter.php line 68:
An exception occurred while executing a query: SQLSTATE[42703]: Undefined column: 7 ERROR: column "type" of relation "appconfig" does not exist
LINE 1: UPDATE "appconfig" SET "type" = $1 WHERE ("appid" = $2) AND ...
^
In Exception.php line 28:
SQLSTATE[42703]: Undefined column: 7 ERROR: column "type" of relation "appconfig" does not exist
LINE 1: UPDATE "appconfig" SET "type" = $1 WHERE ("appid" = $2) AND ...
^
In Statement.php line 130:
SQLSTATE[42703]: Undefined column: 7 ERROR: column "type" of relation "appconfig" does not exist
LINE 1: UPDATE "appconfig" SET "type" = $1 WHERE ("appid" = $2) AND ...
^
config:app:set [--output [OUTPUT]] [--value VALUE] [--type TYPE] [--lazy|--no-lazy] [--sensitive|--no-sensitive] [--update-only] [--] <app> <name>
root@caradhras:[/docker/nextcloud]:
Thanks a lot!
Is it related please?
Unrelated.
Is it related please?
Unrelated.
Should I create new issue then?
Should I create new issue then?
Yes please
We're blocked by this from upgrading our fleet from 28 to 29: we have a provisioning script which does a php occ config:import ...
, and the json file contains among many other settings
[...]
"apps":{
"core":{
"backgroundjobs_mode": "webcron"
[...]
so this bug makes the provisioning fail.
Will this bug be fixed in the 29 series? I see that the MR has milestone set to 31, but as you can't skip major versions that would be unfortunate.
@ariep
I don't think the pull request will address the problem with the config import command. Please leave a comment on the pull request, maybe that can be considered. Don't forget to also open a support ticket with Nextcloud if you have a support contract.
I have the same problem when setting the background image via OCC and also via the WebUI with Nextcloud 30.0.0
EDIT: Tracking in #48436
I'm pleasantly surprised to see the 18 people used the thumbs up reaction, thank you :pray:
It's definitely annoying that changing the background image is broken, sorry about that :disappointed:
Could some please log a fresh issue for the problem? It's a different component that needs a different fix than the background mode. It's perfectly fine to omit most of the issue template (e.g. we don't need the configuration report, logs, etc). Just the basic steps to reproduce, your Nextcloud version and a screenshot would be nice.
Thanks everyone :+1:
EDIT: Tracking in https://github.com/nextcloud/server/issues/48436
Same issue here
⚠️ This issue respects the following points: ⚠️
Bug description
When I want to change the background task execution mode, I have the message "Impossible de mettre à jour le mode d'exécution des tâches d'arrière-plan" (Unable to update background task execution mode)
Steps to reproduce
Expected behavior
Change accepted
Installation method
Community Manual Installation with Archive
Nextcloud Server version
29
Operating system
Debian
PHP engine version
8.3
Web server
Apache
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Update from 28.0.5 to 29.0.0
Are you using the Nextcloud Server Encryption module?
No
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response