Can't load changes/discussions on merge requests of specific project

We’ve been using GitLab for quite some time now, but recently we’re facing some problems on a specific project.

Sometimes on specific merge requests, we’re not able to load the content on the changes tab, neither on the discussion tab.

We already increased the following parameters on gitlab.rb:

unicorn[‘worker_timeout’] = 120
unicorn[‘worker_processes’] = 9 #// We’re running this on a 8-core 16gb VM.
unicorn[‘worker_memory_limit_min’] = 2048*(1024 ** 2)
unicorn[‘worker_memory_limit_max’] = 4096*(1024 ** 2)
nginx[‘keepalive_timeout’] = 120

With the above config, we’ve managed to decrease this problem by 50%, but still happens on a lot of merge requests.

The weird thing is that when we try to call the merge requests’ changes and dicussions trough the API it answes back instantly, but trough the GitLab UI it keeps loading until 502 Timeout.

We also already tried to increase the unicorn and nginx timeout to 10min, just to check what would happen, but still, it keeps loading the discussions/changes until times out.

For now, the workaround is whenever this happens to a merge, close and re-open the merge request.

We’re running:

GitLab 11.3.0 (17bd59a)
GitLab Shell 8.3.3
GitLab Workhorse v6.1.0
GitLab API v4
Ruby 2.4.4p296
Rails 4.2.10
postgresql 9.6.10