Skip to content

Google Drive backup: last_backup_on never updates due to stale DB connection after long upload #17

@kaulith

Description

@kaulith

Description

When upload_system_backup_to_google_drive() runs on sites with large databases, the MySQL connection dies during the long-running mysqldump subprocess and/or Google Drive upload.

The function successfully completes the backup and upload, but fails silently when attempting to write last_backup_on at the end because the database connection is already gone.

Root Cause

MySQL's wait_timeout closes idle connections.

During mysqldump (executed as a subprocess via execute_in_shell) and the Google Drive upload (google_drive.files().create()), there is no database activity from the Python process.

By the time the function reaches
frappe.db.set_single_value("Google Drive", "last_backup_on", ...),
the connection has already been killed.

The framework's execute_job wrapper then also fails at frappe.db.commit() with errors like:

  • InterfaceError(0, '')
  • MySQL server has gone away

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions