nextcloud / nextcloud/serverinfo

[Bug]: Database checks: Replica lag falsely reports failure on standalone MariaDB without replication

Open
#1,147 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
JavaScript
Stars
130
Forks
64
Avg merge
1d 1h
Merged PRs (30d)
49

Description

⚠️ This issue respects the following points: ⚠️
  • This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
  • This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
  • I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
  • I agree to follow Nextcloud's Code of Conduct.
  • I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description

Replica lag falsely reports failure on standalone MariaDB without replication

Steps to reproduce
  1. Run Nextcloud 35.0.0 with a standalone MariaDB 11.4 server.
  2. Do not configure any MariaDB replication.
  3. Open:
    Administration settings → System → Database checks
  4. The "Replica lag" (Slave_lag) check reports:

    A configured replica is not running.

    Slave_running is reporting OFF.

  5. Check the MariaDB status variable:
    SHOW GLOBAL STATUS LIKE 'Slave_running';
    Result:
    +---------------+-------+
    | Variable_name | Value |
    +---------------+-------+
    | Slave_running | OFF   |
    +---------------+-------+
    
    

There is no replication configured on this MariaDB server.

Expected behavior

The replication check should be skipped / marked as not applicable when the MariaDB server has no replica configured.
Slave_running = OFF alone does not appear to be sufficient to determine that a configured replica has stopped.
The Database checks page should therefore not report a replication failure on a standalone MariaDB instance without replication.

Nextcloud Server version

35

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.5

Web server

Apache (supported)

Database engine version

MariaDB

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

Upgraded to a MAJOR version (ex. 31 to 32)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "filelocking.enabled": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "upgrade.disable-web": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.domain.com",
            "nextcloud.service"
        ],
        "serverid": "nextcloud",
        "overwritehost": "cloud.domain.com",
        "overwrite.cli.url": "https:\/\/cloud.domain.com",
        "overwriteprotocol": "https",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "35.0.0.10",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "default_phone_region": "PT",
        "trustedproxies": [
            "nextcloud.service",
            "192.168.110.109"
        ],
        "maintenance_window_start": 1,
        "maintenance": false,
        "preview_max_x": "1024",
        "preview_max_y": "1024",
        "jpeg_quality": "60",
        "preview_max_memory": "1024",
        "preview_max_filesize_image": "50",
        "enabledPreviewProviders": [
            "OC\\Preview\\Image",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\Movie",
            "OC\\Preview\\Krita",
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MKV",
            "OC\\Preview\\MP4",
            "OC\\Preview\\AVI",
            "OC\\Preview\\PDF",
            "OC\\Preview\\Imaginary"
        ],
        "enable_previews": true,
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": true,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "filesystem_check_changes": 0,
        "tempdirectory": "\/var\/www\/html\/data\/tmp",
        "loglevel": 3
    }
}
List of activated Apps
Enabled:
  - activity: 8.0.0
  - appstore: 2.0.0-dev.0
  - bruteforcesettings: 8.0.0
  - circles: 35.0.0
  - cloud_federation_api: 2.0.0-dev.0
  - comments: 2.0.0-dev.0
  - contactsinteraction: 2.0.0-dev.0
  - dashboard: 8.0.0-dev.0
  - dav: 2.0.0-dev.1
  - federatedfilesharing: 2.0.0-dev.1
  - federation: 2.0.0-dev.0
  - files: 3.0.0-dev.0
  - files_downloadlimit: 5.3.0
  - files_lock: 35.0.0
  - files_pdfviewer: 8.0.0
  - files_reminders: 2.0.0-dev.0
  - files_sharing: 2.0.0-dev.1
  - files_trashbin: 2.0.0-dev.0
  - files_versions: 2.0.0-dev.0
  - firstrunwizard: 8.0.0
  - logreader: 8.0.0
  - lookup_server_connector: 2.0.0-dev.0
  - nextcloud_announcements: 7.0.0
  - notifications: 8.0.0
  - oauth2: 2.0.0-dev.0
  - office: 1.1.0
  - password_policy: 7.0.0
  - photos: 8.0.0
  - privacy: 7.0.0
  - profile: 2.0.0-dev.0
  - provisioning_api: 2.0.0-dev.0
  - recommendations: 8.0.0
  - related_resources: 6.0.0
  - serverinfo: 7.0.0
  - settings: 2.0.0-dev.0
  - sharebymail: 2.0.0-dev.0
  - sharing: 1.0.4
  - support: 7.0.0
  - systemtags: 2.0.0-dev.0
  - text: 9.0.0
  - theming: 3.0.0-dev.0
  - twofactor_backupcodes: 2.0.0-dev.0
  - twofactor_nextcloud_notification: 9.0.0
  - twofactor_totp: 17.1.0
  - updatenotification: 2.0.0-dev.0
  - user_status: 2.0.0-dev.0
  - viewer: 8.0.0
  - weather_status: 2.0.0-dev.0
  - webhook_listeners: 2.0.0-dev.0
  - workflowengine: 3.0.0-dev.0
Disabled:
  - admin_audit: 2.0.0-dev.0
  - app_api: 35.0.0 (installed 32.0.0)
  - encryption: 3.0.0-dev.0
  - eurooffice: 11.0.0 (installed 11.0.0)
  - files_external: 2.0.0-dev.0
  - previewgenerator: 5.13.0 (installed 5.13.0)
  - survey_client: 7.0.0 (installed 6.0.0-dev.0)
  - suspicious_login: 13.0.0 (installed 9.0.1)
  - user_ldap: 2.0.0-dev.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs

Additional info

The check appears to be implemented in:
apps/serverinfo/lib/Database/RuleSet/Mysql.php

The rule in Nextcloud 35.0.0 is:

$rules[] = new Rule(
    id: 'Slave_lag',
    name: 'Replica lag',
    category: 'Replication',
    severity: Rule::SEVERITY_ALERT,
    formula: 'Slave_running',
    test: 'value == 0',
    issue: 'A configured replica is not running.',
    recommendation: 'Check the replica with SHOW REPLICA STATUS; resolve any IO/SQL errors and restart replication.',
    justification: 'Slave_running is reporting OFF.',
    justificationFormula: '',
    requires: ['Slave_running'],
);

The rule seems to interpret:
Slave_running = OFF

Server configuration:
Nextcloud: 35.0.0
Database: MariaDB 11.4
Database topology: single standalone MariaDB instance
Replication: not configured
Nextcloud app reporting the check: serverinfo

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 in apps/serverinfo/lib/Database/RuleSet/Mysql.php and inspect the Slave_lag rule and its use of Slave_running. Reproduce the Database checks result with a standalone MariaDB instance, then verify the check is skipped or marked not applicable when replication is not configured and no longer reports a failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, php
Domain
database, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.