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
Description
When
upload_system_backup_to_google_drive()runs on sites with large databases, the MySQL connection dies during the long-runningmysqldumpsubprocess and/or Google Drive upload.The function successfully completes the backup and upload, but fails silently when attempting to write
last_backup_onat the end because the database connection is already gone.Root Cause
MySQL's
wait_timeoutcloses idle connections.During
mysqldump(executed as a subprocess viaexecute_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_jobwrapper then also fails atfrappe.db.commit()with errors like:InterfaceError(0, '')MySQL server has gone away