title: Why does GitLab merge request returns "500 Internal Server Error"?
body: <p>My user wants to merge a request on our hosted GitLab EE 11.5.2 website.
  But the website returns <strong>500 Internal Server Error</strong> as follows:</p>
  <p><a href="https://i.stack.imgur.com/Un2cn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Un2cn.png" alt="enter image description here" /></a></p>
  <p>The related log is as follows:</p>
  <pre><code>Completed 500 Internal Server Error in 56565ms (ActiveRecord: 746.1ms | Elasticsearch: 0.0ms)
  
  ActionView::Template::Error (4:Deadline Exceeded):
    42:             %li.diffs-tab
    44:                 Changes
    45:                 %span.badge.badge-pill= @merge_request.diff_size
    46:
    47:     #diff-notes-app.tab-content
    48:       #new.commits.tab-pane.active
  lib/gitlab/gitaly_client/diff_stitcher.rb:13:in `each'
  lib/gitlab/gitaly_client/diff_stitcher.rb:13:in `each'
  lib/gitlab/git/diff_collection.rb:107:in `each_gitaly_patch'
  lib/gitlab/git/diff_collection.rb:47:in `each'
  lib/gitlab/git/diff_collection.rb:83:in `each_with_index'
  lib/gitlab/git/diff_collection.rb:83:in `decorate!'
  lib/gitlab/diff/file_collection/base.rb:32:in `diff_files'
  lib/gitlab/diff/file_collection/base.rb:9:in `real_size'
  app/models/merge_request.rb:411:in `diff_size'
  app/views/projects/merge_requests/creations/_new_submit.html.haml:45:in `block in _app_views_projects_merge_requests_creations__new_submit_html_haml__4084413277917201848_70167460469980'
  app/views/projects/merge_requests/creations/_new_submit.html.haml:43:in `_app_views_projects_merge_requests_creations__new_submit_html_haml__4084413277917201848_70167460469980'
  app/views/projects/merge_requests/creations/new.html.haml:6:in `_app_views_projects_merge_requests_creations_new_html_haml__4204914316377908944_70167458972060'
  app/controllers/application_controller.rb:116:in `render'
  lib/gitlab/i18n.rb:55:in `with_locale'
  lib/gitlab/i18n.rb:61:in `with_user_locale'
  app/controllers/application_controller.rb:427:in `set_locale'
  lib/gitlab/middleware/multipart.rb:101:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  ee/lib/gitlab/jira/middleware.rb:15:in `call'
  lib/gitlab/middleware/go.rb:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/middleware/rails_queue_duration.rb:22:in `call'
  lib/gitlab/metrics/rack_middleware.rb:15:in `block in call'
  lib/gitlab/metrics/transaction.rb:53:in `run'
  lib/gitlab/metrics/rack_middleware.rb:15:in `call'
  lib/gitlab/middleware/read_only/controller.rb:40:in `call'
  lib/gitlab/middleware/read_only.rb:16:in `call'
  lib/gitlab/middleware/basic_health_check.rb:25:in `call'
  lib/gitlab/request_context.rb:20:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
  lib/gitlab/middleware/release_env.rb:10:in
  </code></pre>
  <p>Could you please tell me how to troubleshoot this problem?</p>
  <p>Thank you.</p>