Skip to content

[Bug]: backup locks the MySQL database and takes the panel down #961

Open
PasarGuard/scripts
#49

Description

@JavadMoqaddam

Before you submit

  • I searched existing issues and did not find the same problem.
  • I am using the latest available PasarGuard version, or I included the exact version below.

PasarGuard version

5.4.1

Installation type

Docker Compose

What happened?

On a MySQL setup, pasarguard backup runs mysqldump without --single-transaction, so it takes a table READ lock for the whole dump. On a large DB the lock lasts minutes and blocks all writes: the panel becomes unresponsive (Cloudflare 521) and nodes/users drop until the backup finishes.

Steps to reproduce

  1. Use MySQL as the database.
  2. Run pasarguard backup (or the nightly cron) while the panel is in use.
  3. During the dump, writes are blocked and the panel returns 521 until it finishes.

Expected behavior

mysqldump should run with --single-transaction so the backup takes a consistent InnoDB snapshot without locking the database, and the panel stays up during backup.

Logs and error messages

mysqldump warning during backup:
"In order to ensure a consistent backup of the database, pass --single-transaction or --lock-all-tables or --source-data."

Environment

OS: Ubuntu 26
Database: MySQL

Relevant configuration

Screenshots or videos

No response

Additional context

Note: the backup code lives in the PasarGuard/scripts repo → lib/pasarguard-backup.sh,
where mysqldump is called as: mysqldump ... --databases --events --triggers (no --single-transaction).
Adding --single-transaction there fixes it — it's InnoDB-safe and automatically turns off --lock-tables,
so it's a one-flag change with no downside for the panel's schema.

Activity

  1. added
    bug
    on Sep 29, 2026
  2. JavadMoqaddam commented on Nov 23, 2026

    @JavadMoqaddam
    Author

    Opened a fix in PasarGuard/scripts#49: every mysqldump / mariadb-dump call in pasarguard backup (seven of them) now runs with --single-transaction, so the dump reads a consistent InnoDB snapshot instead of locking the tables and the panel keeps serving while a backup runs. It carries the same script change as PasarGuard/scripts#40 (closed without merging), rebased on current main, plus a unit test that fails if any dump call loses the flag.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions