Skip to content

Open Merge Requests has slow loading widgets on Project with very large CODEOWNER files

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

If a project has a very large CODEOWNERS file with thousands of lines of rules then the Approval Widget and Mergability queries will take significantly longer to load sometimes longer than 30 seconds.

Steps to reproduce

Install fakedata Create a shell script using the below to generate a very large CODEOWNERS file:

#!/bin/sh

for i in `seq 1 5000`; do
  RANDOM_DOMAIN=$(fakedata --limit 1 domain)
  RANDOM_ANIMAL=$(fakedata --limit 1 animal)
  RANDOM_PATH=$(echo "/$RANDOM_ANIMAL/$RANDOM_DOMAIN")
  RANDOM_USERS_AND_EMAILS=$(fakedata --limit 1 email email  email email email email email email  email email email email email email  email email email email email email  email email email email)
  echo "$RANDOM_PATH $RANDOM_USERS_AND_EMAILS" >> CODEOWNERS;
done
  1. Create a CODEOWNERS files with thousands of lines of rules using the above script
  2. Add a rule at the top which /Readme.md someone@somewhere.com
  3. Create a new branch
  4. Make a change to Readme.md which requires code owner approval
  5. Open a new Merge request
  6. See how long the mergability widgets take to load.
  7. Refresh the page and the symptom will re-occur until the merge request is closed/merged.
  8. Now create another branch
  9. Make changes to another file that does not have a rule configured in CODEOWNERS files
  10. Create a MR and see the difference.

Example Project

What is the current bug behavior?

Merge Request mergability widget take 30 seconds or more to load.

What is the expected correct behavior?

Should load quicker.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by 🤖 GitLab Bot 🤖