ExclusiveLease error in spec/features/merge_request/user_closes_reopens_merge_request_state_spec.rb
## The problem [The `spec/features/merge_request/user_closes_reopens_merge_request_state_spec.rb` spec](https://gitlab.com/gitlab-org/gitlab/-/blob/6d09066dbce0da8e0b5d57a2134abaea68060ed0/spec/features/merge_request/user_closes_reopens_merge_request_state_spec.rb#L67-77) is sometimes timing out CI/CD jobs with the following error: ```ruby when closed when clicking the bottom `Reopen merge request` button DEPRECATION WARNING: using BatchLoader.for in GraphQL is deprecated. Use BatchLoader::GraphQL.for instead or return BatchLoader::GraphQL.wrap from your resolver. 2025-01-23 19:03:02 +0000 Rack app ("GET /namespace83/project-83/-/merge_requests/1/widget.json" - (127.0.0.1)): #<Gitlab::ExclusiveLease::LeaseWithinTransactionError: Exclusive lease cannot be obtained within a transaction as it could lead to idle transactions.> WARN: Screenshot could not be saved. `page.current_path` is empty. WARNING: step_script could not run to completion because the timeout was exceeded. For more control over job and script timeouts see: https://docs.gitlab.com/ee/ci/runners/configure_runners.html#set-script-and-after_script-timeouts ERROR: Job failed: execution took longer than 1h30m0s seconds ``` It seems that once this error happens, the CI/CD job is stuck until it times out. ```ruby 2025-01-23 19:03:02 +0000 Rack app ("GET /namespace83/project-83/-/merge_requests/1/widget.json" - (127.0.0.1)): #<Gitlab::ExclusiveLease::LeaseWithinTransactionError: Exclusive lease cannot be obtained within a transaction as it could lead to idle transactions.> ``` Examples: 1. https://gitlab.com/gitlab-org/gitlab/-/jobs/8753003210#L922 2. https://gitlab.com/gitlab-org/gitlab/-/jobs/8917373051#L2150 3. https://gitlab.com/gitlab-org/gitlab/-/jobs/8939940784 4. https://gitlab.com/gitlab-org/gitlab/-/jobs/8923215168#L2941 5. https://gitlab.com/gitlab-org/gitlab/-/jobs/8936092418#L777
issue