Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Merge request stuck in locked state when getting merged in a merge train
### Summary
A customer reported an issue ([ticket](https://gitlab.zendesk.com/agent/tickets/364744), internal) wherein a MR got stuck in a locked state when it was getting merged. The MR was in a merge train and also made the merge train stuck.
To unstuck the merge train, the MR had to be deleted.
### What is the current *bug* behavior?
The MR shows the `locked` state of the MR. State shows open while the icon is showing a merge icon and the widget shows it's being merged.
### What is the expected *correct* behavior?
The MR should've been completely merged.
### Possible fixes
Based on discussion in https://gitlab.com/gitlab-org/gitlab/-/issues/389044#note_1250042710, we can do the following:
- Set the `ttl` for deduplication of `MergeTrains::RefreshWorker` to 1 hour.
- Modify `MergeTrains::RefreshService` to unstuck stucked merge trains (update the status to `stale` from `merging`). We also need to unlock (`MergeRequest#unlock`) the MR associated to a merge train so it can be merged again. If the MR was already merged though (the merge commit is present) but the MR is unlocked, we should update the state to `merged`.
When implementing the proposed fix, try to test by breaking your local environment like what was done in https://gitlab.com/gitlab-org/gitlab/-/issues/389044#note_1303396262.
issue