This morning I upgraded to 6.9, but got 502 error when I click 'compare branches' in the first step of "Two step Merge Request process".(502 page shows about 10 seconds after clicking the button)
I think this only happens when the repo and MR are large(over 100MB for this one), since this error does not appear in my small repos.
My Gitlab CE is installed in an 8 GB memory computer.
I already downgraded to 6.8 to make MR work, I'm waiting for solving this issue before I upgrade my Gitlab again.
Thanks!
Designs
An error occurred while loading designs. Please try again.
Child items
0
Show closed items
GraphQL error: Variable $iid of type ID! was provided invalid value
No child items are currently open.
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
I've experienced the same issue. We've got a ~400MB repo and some MRs were timing out (mostly when the diff would usually be considered too big to display by the MR screen). I raised the unicorn timeout from 30sec to 5 minutes temporarily to allow us to submit the MRs and we saw the full diff (which was huge).
I'd expect the workflow to decide that the diff is too big to view rather than attempting to show it always.
We are rating this as non-critical for 7.0 since you can work around it by merging from the command line. We're working very hard on features that must ship in 7.0 so we are lacking capacity to look into this. Any help is appreciated.
I will explore the timeout theory either tonight or tomorrow night. @nick.huanca, @mhanson and @liuyang1204 - If I come up with a potential fix could any of you help test it? I'm not confident I'll be able to reproduce the issue and validate the fix.
Unfortunately I'm not able to test - we had to roll back to the previous release as the time needed to render the diffs once we ramped up the unicorn timeout was unacceptable. It should be easily reproducible on any repository with a large number of files by pushing a branch with every file deleted then attempting to merge it (as that would cause a huge diff).
@dblessing@dzaporozhets Thanks for your help, but same with Matt, I'm not able to test, neither. My Gitlab is under compact production use. I already got complaints from devs in my team because of the last upgrading & downgrading, we lost all comments of that whole day. It is risky for me to test it again.
Same with Matt, again, I think it is easily reproducible.
@dzaporozhets I will look for the changes you're going to push and try to test this issue today.
I noticed another issue with this step of MRs yesterday where all file changes were shown in the list but not all the diffs were shown. Do any of these changes you pushed fix that, that you know of? If you're not sure, I will open a new issue to track that.
@ayr-ton As I mentioned on github, it seems the timeout value in the gitlab.yml config is not used when doing satellites (some or all, not sure) actions.
However, @dzaporozhets mentioned modifying the max_size and yours seems identical to the default value (well the default value before commit 3780444c which happened not long ago).
You could give a try. If it does not help, you could try this change I performed on my instance.
Catch timeout in satellite and show proper error message:
However if you use GitLab with huge merge requests(ex. 10k changed files) and big binary files(maybe HD movies 😄 ) you may need to play with config and unicorn/satellite timeouts.
@dzaporozhets That's a good improvement already, thanks 😄!. May I ask that the timeout defined in gitlab.yml overrides the hardcoded timeout (in action.rb) of satellite actions? That would help people with large repositories (or slow hard disk) so they can actually tweak the git timeout of satellite actions.
Hi, @dzaporozhets Thanks for help.
I tried to increase max_size and timeout but my problem is still not solved.
FYI, I found this error not only happens when we have large diffs, but also small diffs. The key is "large repo".
I've tried to make a MR with only less than 10 lines change, this error happens, either.
And one thing I feel strange is that "compare" feature response smoothly while "MR compare" seems very slow.
I've tried out a fix on my problem, change the new method app/controllers/projects/merge_requests_controller.rb
(sorry that I may not be able to push and make merge request, so I just paste my change)
defnew@merge_request=MergeRequest.new(params[:merge_request])@merge_request.source_project=@projectunless@merge_request.source_project@merge_request.target_project||=(@project.forked_from_project||@project)@target_branches=@merge_request.target_project.nil??[]:@merge_request.target_project.repository.branch_names@merge_request.target_branch||=@merge_request.target_project.default_branch@source_project=@merge_request.source_projectif@merge_request.target_branch&&@merge_request.source_branchif@merge_request.target_project==@merge_request.source_project@compare_failed=falsecompare=Gitlab::Git::Compare.new(@merge_request.target_project.repository.raw_repository,@merge_request.target_branch,@merge_request.source_branch,MergeRequestDiff::COMMITS_SAFE_SIZE)@commits=compare.commitsif@commits@commits.map!{|commit|Commit.new(commit)}@commit=@commits.firstelse# false value because failed to get commits from satellite@commits=[]@compare_failed=trueend@note_counts=Note.where(commit_id: @commits.map(&:id)).group(:commit_id).countbegin@diffs=compare.diffs@merge_request.title=@merge_request.source_branch.titleize.humanize@target_project=@merge_request.target_project@target_repo=@target_project.repositorydiff_line_count=Commit::diff_line_count(@diffs)@suppress_diff=Commit::diff_suppress?(@diffs,diff_line_count)@force_suppress_diff=@suppress_diffrescueGitlab::Satellite::BranchesWithoutParent@error="Selected branches have no common commit so they cannot be merged."endelsecompare_action=Gitlab::Satellite::CompareAction.new(current_user,@merge_request.target_project,@merge_request.target_branch,@merge_request.source_project,@merge_request.source_branch)@compare_failed=false@commits=compare_action.commitsif@commits@commits.map!{|commit|Commit.new(commit)}@commit=@commits.firstelse# false value because failed to get commits from satellite@commits=[]@compare_failed=trueend@note_counts=Note.where(commit_id: @commits.map(&:id)).group(:commit_id).countbegin@diffs=compare_action.diffs@merge_request.title=@merge_request.source_branch.titleize.humanize@target_project=@merge_request.target_project@target_repo=@target_project.repositorydiff_line_count=Commit::diff_line_count(@diffs)@suppress_diff=Commit::diff_suppress?(@diffs,diff_line_count)@force_suppress_diff=@suppress_diffrescueGitlab::Satellite::BranchesWithoutParent@error="Selected branches have no common commit so they cannot be merged."endendendend
The point is I found Gitlab::Git::Compare is much faster than Gitlab::Satellite::CompareAction.
And I do not understand why we have two implementation of the similar "compare" function.
I know one difference is that Gitlab::Git::Compare can not do comparison between different projects.
Well, this is only a temporary fix since it still can not solve the problem when use want to make MR between different projects in large repo
The https://github.com/gitlabhq/gitlabhq/pull/7316 should help fixing this issue.
Put a high value to gunicorn timeout and a high value to satellites timeout under gitlab.yml. It should fix the issue.
@matthieu.o.vachon I basically used your logic to change satellites timeout, but with some changes to fetch this from gitlab.yml as you propose. And also, with unit tests (:
@ayr-ton Thanks! Your work should be able to solve some problems, but I think this issue is still not completely solved.
As I mentioned, the problem is that the comparison itself is very slow.
I've already tried to increase the timeout in lib/gitlab/satellite/action.rb, from 30 to 300.
But the result was that instead of getting error after waiting 30s, I got error after 5min.
And the comparison only contains less than 10 lines diff, actually.
I can confirm this issue is still in Gitlab 7.1, with exactly the same symptoms as Liu Yang identified (large repository, any size commit).
Also couldn't get the code in Liu Yang's post to work with Gitlab 7.1. Possibly because we have different versions of Rails, I had to add a line and change the assignment of @merge_request:
Even doing that I still get an error that the method Commit::diff_suppress does not exist (which grepping through the code would seem to be correct):
Completed 500 Internal Server Error in 645msNoMethodError (undefined method `diff_suppress?' for Commit:Class): app/controllers/projects/merge_requests_controller.rb:94:in `new'
Am I doing something wrong, or does code to fix this need to be updated for Gitlab 7.1/Rails 4?
Earlier @liuyang1204 pointed out that the compare view /group/project/compare and the 'new merge request' diff /group/project/merge_requests/new use different code to get the diff. Starting with 2ef45507 we are trying to share more code between the compare view and the 'new merge request' diff in 7.2.
Could anybody check (in a staging environment) if the current master behaves better? What I would hope for to happen is that the max_size and timeout settings in config/gitlab.yml start to have more of an impact on the 'new merge request' diff.
This is ocuring on 7.4.3 for me as well. I have a 11mb repository which causes the ruby process to run out of memory upon creating a merge request. Using the latest scientific methods for profiling this (top), I am able to observe the ruby vm increasing memory allocation until it runs out of memory, then unicorn pops smoke and reaps the process and 502's the user creating the MR.
I hit this issue while submitting a merge request with about 400 files, but nothing really big. I've tried to raise the timeout option, but the Unicorn worker is still running at 100% CPU. This doesn't seem to be a memory issue (less than 25% RAM, 0% swap).
@warren.seine Please create a new issue and provide details, including log files. 8.x releases no longer have satellites so although the issue appears to be the same, it may not be related at all. You can mention this issue in your new issue so we can draw comparisons.