GraphQL operation approvalSummary can be too slow for Rails in large MRs
Summary
Similarly to Investigate slowness in getState GraphQL query (#562586 - closed), I think there can also be a performance bottleneck with approvalSummary.
This also seems related to #463017 (comment 1933159594)
Steps to reproduce
- Check .com logs:
json.graphql.operation_name: "approvalSummary" and json.meta.caller_id: "GraphqlController#execute" and json.cpu_s > 50(internal dashboard) - Search for a found example with
json.correlation_id: "…"and use thejson.variablesfield to construct the MR URL. - Check the MR, and confirm number of commits, changes, and note that the
Approvalwidget does not load. - Check number of CODEOWNERS in the project (incl. size of aliased groups). The line count in CODEOWNERS is not the crucial factor, I think.
Example Project
See steps above to find them. Also, in this internal customer case, a CODEOWNERS file with >5k and MRs that change thousands of files ran into the gitlab_rails['graphql_timeout']/global.appConfig.graphQlTimeout limit.
I also started reproducing this internally, but maybe the lack of real usernames (I didn't want to risk pinging anyone) prevented triggering the problem. Or, the test MRs were still too small.
What is the current bug behavior?
Approval widget does not load and back-end logs 500/Rack::Timeout::RequestTimeoutException.
What is the expected correct behavior?
A clearer error (maybe based on documented limit to the number of commits, changes or CODEOWNER rules that are parsed) or improved performance for even such large MRs.
Relevant logs and/or screenshots
See steps above to find them.
Output of checks: This bug happens on GitLab.com
Possible fixes
See expected behaviour ideas above.