-
Bug
-
Resolution: Fixed
-
Low
-
8.0.0
-
Severity 3 - Minor
-
Bitbucket becomes unusable when the user exits from the Maintenance mode when there is a running backup task.
Steps to reproduce
- Enter the Maintenance mode:
λ: curl -L -s -f -u "admin" -X POST -H "Content-type: application/json" "http://localhost:7990/mvc/maintenance/lock" | jq . Enter host password for user 'admin': { "unlockToken": "db666f4896521fae93c7947c089d1d468f26c55f", "owner": { "displayName": "admin", "name": "admin" } }
λ: curl -L -s -f http://localhost:7990/status | jq . { "state": "MAINTENANCE" }
- Before starting the backup task:
λ: curl -L -s -f -u "admin" -X GET -H "X-Atlassian-Maintenance-Token: db666f4896521fae93c7947c089d1d468f26c55f" -H "Accept: application/json" -H "Content-type: application/json" "http://localhost:7990/mvc/maintenance" | jq . Enter host password for user 'admin': { "task": null, "db-state": "AVAILABLE", "scm-state": "AVAILABLE" }
- Start backup task:
λ: curl -L -s -f -u "admin" -X POST -H "X-Atlassian-Maintenance-Token: db666f4896521fae93c7947c089d1d468f26c55f" -H "Accept: application/json" -H "Content-type: application/json" "http://localhost:7990/mvc/admin/backups?external=true" | jq . Enter host password for user 'admin': { "id": "6210e1ad-f898-42e4-b332-ba292fde8213", "progress": { "message": "Closing database connections", "percentage": 0 }, "state": "RUNNING", "type": "BACKUP", "cancelToken": "365c5ab8fba24d59276276f4aeb90395468a456c" }
- After starting the backup task:
λ: curl -L -s -f -u "admin" -X GET -H "X-Atlassian-Maintenance-Token: db666f4896521fae93c7947c089d1d468f26c55f" -H "Accept: application/json" -H "Content-type: application/json" "http://localhost:7990/mvc/maintenance" | jq . Enter host password for user 'admin': { "task": { "id": "6210e1ad-f898-42e4-b332-ba292fde8213", "progress": { "message": "Backing up Bitbucket home", "percentage": 10 }, "state": "RUNNING", "type": "BACKUP" }, "db-state": "DRAINED", "scm-state": "DRAINED" }
The backup percentage will automatically be set to 10%.
Current behaviour:
The system allows users to exit the Maintenance mode:
λ: curl -L -s -f -u "admin" -X DELETE -H "Accept: application/json" -H "Content-type: application/json" "http://localhost:7990/mvc/maintenance/lock?token=db666f4896521fae93c7947c089d1d468f26c55f" Enter host password for user 'admin':
The following log messages will be logged into atlassian-bitbucket.log:
2024-09-04 05:42:36,409 INFO [hz.hazelcast.cached.thread-10] c.a.s.i.m.DefaultMaintenanceLock Maintenance has been completed. The system lock has been released
The Bitbucket state and the backup task will remain unchanged:
λ: curl -L -s -f http://localhost:7990/status | jq . { "state": "MAINTENANCE" }
λ: curl -L -s -f http://localhost:7990/status | jq . λ: curl -L -s -f -u "admin" -X GET -H "X-Atlassian-Maintenance-Token: db666f4896521fae93c7947c089d1d468f26c55f" -H "Accept: application/json" -H "Content-type: application/json" "http://localhost:7990/mvc/maintenance" | jq . Enter host password for user 'admin': { "task": { "id": "6210e1ad-f898-42e4-b332-ba292fde8213", "progress": { "message": "Backing up Bitbucket home", "percentage": 10 }, "state": "RUNNING", "type": "BACKUP" }, "db-state": "DRAINED", "scm-state": "DRAINED" }
Bitbucket will remain in an unusable state until the user restarts Bitbucket.
Expected behaviour:
When there is a running backup task, the system should not allow users to exit the Maintenance mode.
The system should throw an error message saying that a backup task is running. To exit Maintenance mode, the user should cancel the backup task or update the backup progress to 100.
curl -L -s -f -u "<<admin username>>" -X POST -H "Accept: application/json" -H "Content-type: application/json" "<<base url>>/mvc/admin/backups/progress/client?token=<<lock_token>>&percentage=100"