Unable to push to bitbucket: pre-receive hook declined due to 'relation lock' in Bitbucket's DB

Issue #12869 duplicate
created an issue

I have been using Bitbucket for several years with no problems.

Today, if I try to push a git commit to any of my git repositories, I get the following error:

git push
Counting objects: 16, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.21 KiB | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: canceling statement due to conflict with recovery
remote: LINE 1: ...er"."date_joined" FROM "bb_repository" INNER JOIN "auth_user...
remote:                                                              ^
remote: DETAIL:  User was holding a relation lock for too long.
To git@bitbucket.org:<org>/<repo>.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@bitbucket.org:<org>/<repo>.git'

Similarly, if I try to submit an online edit through the web interface, eg: by editing the readme file, I get a 500 internal server error, code 138782da7fcc476cb5aec98b6a07fb28.

This might be related to the switch to Atlassian user accounts? I use a Bitbucket account.

Obviously, this makes bitbucket pretty well unusable until this can be resolved.