MR Comments not loading when exceeding about 50 comments

Summary

When doing a code review for an merge request exceeding about 50 comments, GitLab can't load the comments and displays the error Something went wrong while fetching comments. Please try again.. If you inspect the network tab you can see that the request to https://git.example.com/org/project/-/merge_requests/1562/discussions.json?per_page=20 results in a 500. Our IT team could trace down that the db response only took a few milliseconds.

Steps to reproduce

  1. Open a big MR, mine had about 90 changed files and +2663 -2003
  2. Do a code review with a lot of comments, mine had 82 (there were code suggestions within that)
  3. Try to load the comments in the overview

What is the current bug behavior?

The discussions request times out after 1min and ends up in a 500.

What is the expected correct behavior?

The discussions request should answer with the comments and a 200.

Relevant logs and/or screenshots

image

image

Results of GitLab environment info

Version: GitLab Enterprise Edition 15.4.3-ee, self-hosted

Possible fixes

Only thing I can provide is that the db does not seem to be the problem.