Some Private Projects time out when fetching via v4 API

Summary

When fetching project using v4 API, some projects time out.

Steps to reproduce

Certain projects time out for certain users. For example, user @yossi.z cannot fetch https://gitlab.com/api/v4/projects?per_page=1&page=31&membership=true&private_token={token} but can fetch page=30

I ran the following python script locally, and the results are shown below

import requests

token = 'my_access_token'

projects_url = 'https://gitlab.com/api/v3/projects?per_page=100&membership=true&private_token=' + token
projects_pages_url = 'https://gitlab.com/api/v4/projects?per_page=1&page=%s&membership=true&private_token=' + token

res = requests.get(projects_url)


for i, project in enumerate(res.json(), 1):
    project_id = project['id']

    res1 = requests.get(projects_pages_url % i)
    if res1.text != 'GitLab is not responding':
        print(project_id, 'works\n')
    else:
        print(project_id, res1.text)

Results:

5147004 works
5033336 works
4982439 works
4982163 works
4865151 works
4862392 works
4787169 works
4762658 works
4714682 works
4714668 works
4667056 works
4661706 works
4601044 works
4580250 works
4571616 works
4570807 works
4542386 works
4541676 works
4530562 works
4391855 works
4391648 works
4390887 works
4237516 works
4182193 works
4167373 works
4145969 GitLab is not responding
4140757 works
4113898 works
4086128 works
4067222 GitLab is not responding
4062640 works
4039214 works
4027928 works
4013595 works
4008409 works
3957788 works
3927275 GitLab is not responding
3861723 works
3792594 GitLab is not responding
3743357 works
3728493 works
3721000 works
3652969 GitLab is not responding
3641598 works
3632575 works
3625360 works
3601556 works
3587678 works
3585966 works
3585965 works
3585826 works
3580060 works
3578705 works
3533006 works
3532986 works
3532974 works
2784114 works
2759375 works
2650852 works
2400398 works
2354615 works
2322173 works
2287126 works
2279594 works
2240794 works
2154150 works
2065145 works
2060508 works
1990524 works
1691062 works
1642938 works
1619772 works
1553811 works
1473410 works
1463676 works
1006326 works
4145969 GitLab is not responding
4067222 GitLab is not responding
3927275 GitLab is not responding
3792594 GitLab is not responding

Also fail for my coworker @yossi.z

What is the current bug behavior?

Some repos time out.

What is the expected correct behavior?

Requests to https://gitlab.com/api/v4/projects should return all projects.

Output of checks

This bug happens on GitLab.com

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Assignee Loading
Time tracking Loading