Bitbucket DIY Backup hangs on 0% progress
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
DIY script hangs while taking backup. It stays in a hanging state for hours.
Environment
Bitbucket 7.17.5
Diagnosis
After the backup has been initialised, The system didn't show any progress after 0%
1
DEBUG [threadpool:thread-1] admin @ 127.0.0.1 "POST /mvc/admin/backups HTTP/1.1" c.a.s.i.m.b.BackupClientPlaceholderStep . Current progress: 0
After some hours, the backup gets cancelled automatically as following
1
2
3
4
5
6
7
8
9
10
11
12
13
WARN [threadpool:thread-1] admin @L5W6RMx240x61768x0 127.0.0.1 "POST /mvc/admin/backups HTTP/1.1" c.a.s.i.m.DefaultMaintenanceTaskMonitor BACKUP maintenance has been canceled (Cause: CanceledBackupException: The backup has been canceled.)
com.atlassian.stash.internal.backup.CanceledBackupException: The backup has been canceled.
at com.atlassian.stash.internal.maintenance.backup.AbstractBackupTask.run(AbstractBackupTask.java:89)
at com.atlassian.stash.internal.maintenance.DefaultMaintenanceTaskMonitor.run(DefaultMaintenanceTaskMonitor.java:212)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.atlassian.stash.internal.concurrent.StateTransferringRunnable.run(StateTransferringRunnable.java:50)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.lang.Thread.run(Thread.java:829)
... 1 frame trimmed
Cause
The script is missing a mechanism that allows the system to cancel the status check and retry, avoiding any deadlock issues.
Solution
Please set the following in bitbucket.diy-backup.vars.sh there is the following section, Just replace the entire curl line.
1
2
# Options to pass to every "curl" command
CURL_OPTIONS="-L -s -f"
Also, please change in common.sh from:
1
2
3
4
5
6
7
8
local progress_response=$(curl ${CURL_OPTIONS} -u "${BITBUCKET_BACKUP_USER}:${BITBUCKET_BACKUP_PASS}" -X GET \
-H "X-Atlassian-Maintenance-Token: ${BITBUCKET_LOCK_TOKEN}" -H "Accept: application/json" \
-H "Content-type: application/json" "${BITBUCKET_URL}/mvc/maintenance")
if [ -z "${progress_response}" ]; then
bail "Unable to check for backup progress. \
GET to '${BITBUCKET_URL}/mvc/maintenance' did not return any content"
fi
to:
1
2
3
4
5
6
7
8
local progress_response=$(curl ${CURL_OPTIONS} -u "${BITBUCKET_BACKUP_USER}:${BITBUCKET_BACKUP_PASS}" -X GET \
-H "X-Atlassian-Maintenance-Token: ${BITBUCKET_LOCK_TOKEN}" -H "Accept: application/json" \
-H "Content-type: application/json" "${BITBUCKET_URL}/mvc/maintenance" || echo "UNKNOWN_UNKNOWN")
if [ -z "${progress_response}" ]; then
bail "Unable to check for backup progress. \
GET to '${BITBUCKET_URL}/mvc/maintenance' did not return any content"
fi
This should allow the system to cancel the status check and retry, avoiding any deadlock issues.
Was this helpful?