Skip to content

Nextcloud stuck in maintenance mode: nextcloud-app starts before Redis has loaded its AOF #8149

Description

@stephdl

Steps to reproduce

  • Install a Nextcloud instance and let its Redis AOF grow (a nextcloud-redis-data volume with ~20M keys loads in ~14s)
  • Make a Nextcloud upgrade pending, as the nightly auto-update does
  • Restart the module so all units start together

Expected behavior

nextcloud-app waits for Redis to be usable before running occ upgrade.

Actual behavior

nextcloud-redis.service is Type=forking with a PIDFile, so systemd marks it active as soon as the container forks, not when redis-server has finished loading the AOF. nextcloud-app.service only declares After=nextcloud-redis.service, which orders the start but does not wait for availability.

occ upgrade therefore runs while Redis still answers LOADING Redis is loading the dataset in memory. The schema step succeeds, a repair step throws RedisException, the update fails, and maintenance mode is deliberately kept on. Nothing retries, so the instance stays in maintenance until someone runs occ upgrade by hand.

Sep 03 15:05:51 R2-pve.rocky9-pve2.org systemd[736845]: Started Podman nextcloud-redis.service.   <- systemd marks redis ready: the container forked
Sep 03 15:05:53 R2-pve.rocky9-pve2.org systemd[736845]: Starting Podman nextcloud-app.service...
Sep 03 15:05:53 R2-pve.rocky9-pve2.org nextcloud-app[746340]: Upgrading nextcloud from 33.0.6.2 ...   <- entrypoint starts occ upgrade
Sep 03 15:05:54 R2-pve.rocky9-pve2.org nextcloud-app[746340]: [nextcloud][no app in context][4] {... "Exception":"RedisException","Message":"Could not boot webhook_listeners: LOADING Redis is loading the dataset in memory" ...}
Sep 03 15:05:54 R2-pve.rocky9-pve2.org nextcloud-app[746340]: [nextcloud][no app in context][3] {... "Exception":"RedisException","Message":"Could not boot workflowengine: LOADING Redis is loading the dataset in memory" ...}
Sep 03 15:05:58 R2-pve.rocky9-pve2.org nextcloud-app[746340]: Turned on maintenance mode
Sep 03 15:05:58 R2-pve.rocky9-pve2.org nextcloud-app[746340]: [nextcloud][core][0] {... "message":"starting upgrade from 33.0.6.2 to 33.0.7.1" ...}
Sep 03 15:05:58 R2-pve.rocky9-pve2.org nextcloud-app[746340]: Updated database
Sep 03 15:05:58 R2-pve.rocky9-pve2.org nextcloud-app[746340]: RedisException: LOADING Redis is loading the dataset in memory
Sep 03 15:05:58 R2-pve.rocky9-pve2.org nextcloud-app[746340]: [nextcloud][updater][3] {... "message":"\\OC\\Updater::failure: RedisException: LOADING Redis is loading the dataset in memory" ...}
Sep 03 15:05:58 R2-pve.rocky9-pve2.org nextcloud-app[746340]: Update failed
Sep 03 15:05:58 R2-pve.rocky9-pve2.org nextcloud-app[746340]: Maintenance mode is kept active   <- instance stuck here, nothing retries
Sep 03 15:06:06 R2-pve.rocky9-pve2.org nextcloud-redis[746190]: 1:M 03 Sep 2026 13:06:06.328 * DB loaded from append only file: 14.423 seconds
Sep 03 15:06:06 R2-pve.rocky9-pve2.org nextcloud-redis[746190]: 1:M 03 Sep 2026 13:06:06.328 * Ready to accept connections tcp   <- redis is only usable now, 15s after systemd said it was

systemd[736845], the module user manager, reports the redis unit started at 15:05:51. nextcloud-redis[746190] only accepts connections at 15:06:06, 15 seconds later. Everything nextcloud-app[746340] does in between runs against a Redis that answers LOADING, including the whole occ upgrade. Six RedisException in that window, the last one carrying the update to failure. Long JSON entries are elided at ....

occ status then reports maintenance: true and needsDbUpgrade: true while config/config.php still holds the old version.

nextcloud-db.service already guards against this with a mariadb-admin ping loop in ExecStartPost. The Redis unit has no equivalent.

Components

  • ns8-nextcloud 1.7.4, reproduced on Rocky Linux 9.8
  • docker.io/redis:7.4.5-alpine, started with --appendonly yes

See also

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingPackages are available from testing repositories

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions