CommitDiff & DiffStats timeout for particular commit on GitLab.com
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=430971) </details> <!--IssueSummary end--> ### Summary A commit with dozens/hundreds of long-named `.zip` files, plus many text files changes with thousands of +/- lines (whole Python project with test fixtures) is causing Gitaly to run into its medium/30sec timeout. This bug report is a copy of the internal [section-dev-request-for-help#149](https://gitlab.com/gitlab-com/dev-sub-department/section-dev-request-for-help/-/issues/149). In MR, commit was not the HEAD of the that branch and pipeline didn't trigger. The repository check reports no problem and `git-sizer` locally also doesn't report the commit as problematic. ### Steps to reproduce 1. Check mentioned commit `00e`… in [this internal customer ticket](https://gitlab.zendesk.com/agent/tickets/447124) and load that page as an admin user > `500` error 2. Check same commit within context of its MR. > Commit shows up in commits list, and `/diffs?commit_id=00e` page, but not in the MR's activity. ### Example Project :point_up: ### What is the current *bug* behavior? 500 error in [Sentry](https://sentry.gitlab.net/gitlab/gitlabcom/issues/4181621/?query=correlation_id%3A01H9Q6GZ51HGWMBVVEXR2PNFES) (no equivalent found in `new-sentry` :thinking:) & [ES](https://log.gprd.gitlab.net/app/r/s/JCdJ9) for stacktrace with `lib/gitlab/gitaly_client/diff_stitcher.rb`, and `file already closed`/`parse failure: read diff header line` errors. New sentry: https://new-sentry.gitlab.net/organizations/gitlab/issues/?environment=gprd&project=3&query=is%3Aunresolved+%22Projects%3A%3ACommitController%23show%22+%224%3ADeadline+Exceeded.%22&referrer=issue-list&statsPeriod=3d (by @vyaklushin) Related: https://gitlab.com/gitlab-org/gitlab/-/issues/28424+ (that one is about `conflict_files_stitcher.rb` & 55sec timeout, though) & https://gitlab.com/groups/gitlab-org/-/epics/11559+ ### What is the expected *correct* behavior? - Better error message, see https://gitlab.com/gitlab-org/gitlab/-/issues/27817 ### Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. --> ### 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. -->
issue