Mergability check fails when a lock cannot be obtained

Summary

MergeRequestMergeabilityCheckWorker can fail to obtain a lock when trying to check mergability. This appears to contribute to downstream issues when multiple mergability checks fail on the same Merge Request.

Steps to reproduce

I can't seem to force this error.

Example Project

N/A since this is a locking issue.

What is the current bug behavior?

The MergeRequestMergeabilityCheckWorker can, on occasion, fail to check mergability. I've seen cases where a customer reports issues with a Merge Request and the only logged errors for the MR are Failed to check mergeability of merge request: Failed to obtain a lock. I think this may contribute to inconsistent behavior in Merge Requests.

What is the expected correct behavior?

Better handling of locking failures to improve Merge Request experience

Relevant logs and/or screenshots

Kibana showing this error: https://log.gprd.gitlab.net/app/r/s/ZkTU0

This link shows logs related to a specific MR that had two failed locks and skipped it's merge train: https://log.gprd.gitlab.net/app/r/s/qx4MM When I checked the Merge Request it had not been set to a draft and no conflict was reported in the Activity section; the only reason I could see that it would skip the Merge Train

Output of checks

Possible fixes

N/A

Edited by 🤖 GitLab Bot 🤖