Code comments not saved when diff in MR is too large: "This diff could not be displayed because it is too large."

Summary

On MR under changes with large diffs some files are not display and show up with: "This diff could not be displayed because it is too large." To see the diffs we hit "Hide whitespace changes". The former too large diffs show up. When we now comment on code in these former too large diffs the comment is not saved. With files in the same MR that where displayed when Whitespaces where shown (smaller diffs in the same MR), the comments are saved. The logs show the JSON firing of to the backend with the comment but it is not saved in the DB.

Steps to reproduce

  • Add commit with many lines of changes to produce "This diff could not be displayed because it is too large." in MR
  • Press "Hide whitespace changes" to show diffs anyway.
  • add comment -> comment is not saved

What is the current bug behavior?

Comments are not saved on diff and therefore not shown in the diff or as an activ discussion. The comment is just gone.

What is the expected correct behavior?

Comment should be display like with smaller diff-sets

Relevant logs and/or screenshots

Log shows created JSON on comment save:

Started POST "/some_namespace/Project/notes" for 10.0.4.252 at 2017-04-03 12:35:09 +0200 Processing by Projects::NotesController#create as JSON Parameters: {"utf8"=>"✓", "authenticity_token"=>"#######################", "view"=>"inline", "line_type"=>"", "merge_request_diff_head_sha"=>"83382430f6ed7387864082081ecb3cb5b6a9f550", "target_type"=>"merge_request", "target_id"=>"266", "note"=>{"commit_id"=>"", "line_code"=>"3c36ce6d1e1ae54fe33d2add0e4dd2489e02705f_208_209", "noteable_id"=>"266", "noteable_type"=>"MergeRequest", "type"=>"DiffNote", "position"=>"{\"old_path\":\"Project/Folder/file.cpp\",\"new_path\":\"Project/Folder/file.cpp\",\"old_line\":208,\"new_line\":209,\"base_sha\":\"4a148283e7d039875fc93a5c9620bc1ee34a0563\",\"start_sha\":\"f7eb5aa5350217c02a1aaccef1ed2f395795a8f8\",\"head_sha\":\"83382430f6ed7387864082081ecb3cb5b6a9f550\"}", "note"=>"test"}, "commit"=>"Comment", "namespace_id"=>"some_namespace", "project_id"=>"Project"}

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Omnibus Installation (code tags somehow not working here):

  • System information

  • System: Debian 8.7

  • Proxy: no

  • 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.10.2

  • Sidekiq Version:4.2.7

  • GitLab information

  • Version: 9.0.2-ee

  • Revision: gitlab-ee@3ed621894dca29a611a8f961aa5b30d4471034a6

  • Directory: /opt/gitlab/embedded/service/gitlab-rails

  • DB Adapter: postgresql

  • DB Version: 9.6.1

  • URL: http://gitlab

  • HTTP Clone URL: http://gitlab/some-group/some-project.git

  • SSH Clone URL: git@gitlab:some-group/some-project.git

  • Elasticsearch: no

  • Geo: yes

  • Geo node: Primary

  • Using LDAP: yes

  • Using Omniauth: no

  • GitLab Shell

  • Version: 5.0.0

  • Repository storage paths:

    • default: /mnt/data/git_data/repositories
  • Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/

  • Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

No Errors in Checks Too much sensitiv outbut to post here

Possible fixes

Assignee Loading
Time tracking Loading