Skip to content

500 error when trying to display the diff on a MR

Summary

Running on GitLab 9.3.6 omnibus docker image, when trying to display the diff from one of our MRs the server replies with a 500 error on diffs.json.

Steps to reproduce

None yet since the project is subject to a NDA. I will try to create a test project that exhibits the same behavior then update this issue accordingly.

Example Project

See above.

What is the current bug behavior?

500 error.

What is the expected correct behavior?

diffs.json renders properly.

Relevant logs and/or screenshots

Started GET "/redacted/project-name/merge_requests/58/diffs.json" for 10.0.0.11 at 2017-07-14 06:08:57 +0000
Processing by Projects::MergeRequestsController#diffs as JSON
  Parameters: {"namespace_id"=>"redacted", "project_id"=>"project-name", "id"=>"58"}
Completed 500 Internal Server Error in 225ms (ActiveRecord: 10.6ms)
ActionView::Template::Error (283..286 out of range):
    1: - environment = local_assigns.fetch(:environment, nil)
    2: - show_whitespace_toggle = local_assigns.fetch(:show_whitespace_toggle, true)
    3: - can_create_note = !@diff_notes_disabled && can?(current_user, :create_note, diffs.project)
    4: - diff_files = diffs.diff_files
    5: 
    6: .content-block.oneline-block.files-changed
    7:   .inline-parallel-buttons
  lib/gitlab/string_range_marker.rb:29:in `[]='
  lib/gitlab/string_range_marker.rb:29:in `block in mark'
  lib/gitlab/string_range_marker.rb:23:in `each'
  lib/gitlab/string_range_marker.rb:23:in `each_with_index'
  lib/gitlab/string_range_marker.rb:23:in `mark'
  lib/gitlab/diff/inline_diff_marker.rb:5:in `mark'
  lib/gitlab/diff/highlight.rb:29:in `block in highlight'
  lib/gitlab/diff/highlight.rb:21:in `map'
  lib/gitlab/diff/highlight.rb:21:in `with_index'
  lib/gitlab/diff/highlight.rb:21:in `highlight'
  lib/gitlab/diff/file.rb:129:in `highlighted_diff_lines'
  lib/gitlab/diff/file_collection/merge_request_diff.rb:52:in `cache_highlight!'
  lib/gitlab/diff/file_collection/merge_request_diff.rb:28:in `decorate_diff!'
  lib/gitlab/diff/file_collection/base.rb:25:in `block in diff_files'
  lib/gitlab/git/diff_collection.rb:58:in `block in decorate!'
  lib/gitlab/git/diff_collection.rb:114:in `block in each_patch'
  lib/gitlab/git/diff_collection.rb:88:in `each'
  lib/gitlab/git/diff_collection.rb:88:in `each_patch'
  lib/gitlab/git/diff_collection.rb:28:in `block in each'
  lib/gitlab/gitaly_client.rb:77:in `block in migrate'
  lib/gitlab/metrics/influx_db.rb:92:in `measure'
  lib/gitlab/gitaly_client.rb:76:in `migrate'
  lib/gitlab/git/diff_collection.rb:27:in `each'
  lib/gitlab/git/diff_collection.rb:57:in `each_with_index'
  lib/gitlab/git/diff_collection.rb:57:in `decorate!'
  lib/gitlab/diff/file_collection/base.rb:25:in `diff_files'
  lib/gitlab/diff/file_collection/merge_request_diff.rb:16:in `diff_files'
  app/views/projects/diffs/_diffs.html.haml:4:in `_app_views_projects_diffs__diffs_html_haml__1625963913076817854_70091119610240'
  app/views/projects/merge_requests/show/_diffs.html.haml:3:in `_app_views_projects_merge_requests_show__diffs_html_haml__3197409116935244924_70091120469320'
  app/controllers/application_controller.rb:225:in `view_to_html_string'
  app/controllers/projects/merge_requests_controller.rb:112:in `block (2 levels) in diffs'
  app/controllers/projects/merge_requests_controller.rb:104:in `diffs'
  lib/gitlab/i18n.rb:39:in `with_locale'
  lib/gitlab/i18n.rb:45:in `with_user_locale'
  app/controllers/application_controller.rb:303:in `set_locale'
  lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb:16:in `call'
  lib/gitlab/middleware/multipart.rb:93:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  lib/gitlab/middleware/go.rb:16:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/request_context.rb:18:in `call'

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 10.5.0 Redis Version: 3.2.5 Git Version: 2.13.0 Sidekiq Version:5.0.0 Go Version: unknown

GitLab information Version: 9.3.6 Revision: b9a169c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://redacted.url.net HTTP Clone URL: https://redacted.url.net/some-group/some-project.git SSH Clone URL: ssh://git@redacted.url.net:2222/some-group/some-project.git Using LDAP: yes Using Omniauth: yes Omniauth Providers: github

GitLab Shell Version: 5.1.1 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab Shell ...

GitLab Shell version >= 5.1.1 ? ... OK (5.1.1) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/1 ... ok 5/2 ... ok 6/3 ... ok 7/4 ... ok 11/5 ... ok 2/6 ... ok 5/7 ... ok 10/8 ... ok 15/9 ... ok 5/10 ... ok 17/11 ... ok 15/12 ... ok 14/13 ... ok 14/14 ... ok 2/15 ... repository is empty 19/16 ... ok 22/17 ... ok 21/18 ... ok 21/19 ... ok 20/20 ... ok 25/23 ... ok 15/24 ... repository is empty 15/25 ... repository is empty 15/26 ... repository is empty 8/27 ... ok 5/28 ... ok 2/29 ... ok 9/30 ... ok 21/32 ... ok 5/33 ... ok 6/34 ... repository is empty 33/35 ... ok 2/36 ... ok 33/37 ... ok 32/38 ... ok 32/39 ... ok 36/40 ... ok 42/41 ... ok 32/42 ... ok 2/43 ... ok 38/44 ... ok 9/45 ... ok 2/46 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) ... redacted list of users

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/1 ... yes 5/2 ... yes 6/3 ... yes 7/4 ... yes 11/5 ... yes 2/6 ... yes 5/7 ... yes 10/8 ... yes 15/9 ... yes 5/10 ... yes 17/11 ... yes 15/12 ... yes 14/13 ... yes 14/14 ... yes 2/15 ... yes 19/16 ... yes 22/17 ... yes 21/18 ... yes 21/19 ... yes 20/20 ... yes 25/23 ... yes 15/24 ... yes 15/25 ... yes 15/26 ... yes 8/27 ... yes 5/28 ... yes 2/29 ... yes 9/30 ... yes 21/32 ... yes 5/33 ... yes 6/34 ... yes 33/35 ... yes 2/36 ... yes 33/37 ... yes 32/38 ... yes 32/39 ... yes 36/40 ... yes 42/41 ... yes 32/42 ... yes 2/43 ... yes 38/44 ... yes 9/45 ... yes 2/46 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.3) Git version >= 2.7.3 ? ... yes (2.13.0) Active users: ... 30

Checking GitLab ... Finished

Possible fixes

None that I'm aware of yet.