Skip to content

500 error when viewing merge request with conflict and to a removed branch

Summary

Opening a specific merge request triggers a 500 error.

Steps to reproduce

Unfortunately, I haven't been able to reproduce the issue with a test repository.

The problematic merge request has a merge conflict and targets a branch that was rebased, merged to master and then removed.

What is the current bug behavior?

500 error.

What is the expected correct behavior?

View the merge request.

Relevant logs and/or screenshots

==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/redacted/redacted/merge_requests/797" for redacted at 2018-06-28 13:46:00 +0200
Processing by Projects::MergeRequestsController#show as HTML
  Parameters: {"namespace_id"=>"redacted", "project_id"=>"redacted", "id"=>"797"}
Completed 500 Internal Server Error in 21ms (ActiveRecord: 4.1ms)

==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"GET","path":"/redacted/redacted/merge_requests/797","format":"html","controller":"Projects::MergeRequestsController","action":"show","status":500,"error":"Rugged::ReferenceError: revspec 'redacted-branch' not found","duration":21.18,"view":0.0,"db":4.12,"time":"2018-06-28T11:46:00.249Z","params":[{"key":"namespace_id","value":"redacted"},{"key":"project_id","value":"redacted"},{"key":"id","value":"797"}],"remote_ip":"redacted","user_id":14,"username":"redacted","gitaly_calls":1}

==> /var/log/gitlab/gitlab-rails/production.log <==

Rugged::ReferenceError (revspec 'redacted-branch' not found):
  lib/gitlab/git/repository.rb:2451:in `merge_commits'
  lib/gitlab/git/repository.rb:2451:in `rugged_can_be_merged?'
  lib/gitlab/git/repository.rb:1503:in `block in can_be_merged?'
  lib/gitlab/gitaly_client.rb:287:in `block (2 levels) in migrate'
  lib/gitlab/gitaly_client.rb:331:in `allow_n_plus_1_calls'
  lib/gitlab/gitaly_client.rb:280:in `block in migrate'
  lib/gitlab/metrics/influx_db.rb:98:in `measure'
  lib/gitlab/gitaly_client.rb:278:in `migrate'
  lib/gitlab/git/repository.rb:1447:in `gitaly_migrate'
  lib/gitlab/git/repository.rb:1495:in `can_be_merged?'
  app/models/repository.rb:850:in `can_be_merged?'
  app/models/merge_request.rb:717:in `notify_conflict?'
  app/models/merge_request.rb:132:in `block (2 levels) in <class:MergeRequest>'
  app/models/merge_request.rb:643:in `check_if_can_be_merged'
  app/controllers/projects/merge_requests_controller.rb:262:in `mark_merge_request_mergeable'
  app/controllers/projects/merge_requests_controller.rb:32:in `show'
  lib/gitlab/i18n.rb:50:in `with_locale'
  lib/gitlab/i18n.rb:56:in `with_user_locale'
  app/controllers/application_controller.rb:362:in `set_locale'
  lib/gitlab/middleware/multipart.rb:95:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  lib/gitlab/middleware/go.rb:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/middleware/read_only/controller.rb:28:in `call'
  lib/gitlab/middleware/read_only.rb:16:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
  lib/gitlab/middleware/release_env.rb:10:in `call'

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Debian 9.4 Current User: git Using RVM: no Ruby Version: 2.4.4p296 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.17.1 Sidekiq Version:5.1.3 Go Version: unknown

GitLab information Version: 11.0.2 Revision: d9540ee Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://redacted HTTP Clone URL: https://redacted/some-group/some-project.git SSH Clone URL: git@redacted:some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 7.1.4 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 >= 7.1.4 ? ... OK (7.1.4) 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: ... 10/4 ... ok 10/5 ... ok 10/6 ... repository is empty 10/8 ... ok 10/9 ... ok 10/10 ... ok 10/12 ... ok 10/13 ... ok 15/14 ... ok 15/15 ... ok 15/16 ... ok 15/17 ... ok 10/18 ... ok 16/19 ... ok 10/21 ... ok 10/22 ... ok 10/26 ... ok 10/27 ... ok 10/28 ... ok 10/29 ... ok 10/30 ... ok 10/31 ... ok 10/32 ... ok 9/34 ... ok 15/35 ... ok 10/36 ... ok 18/37 ... ok 18/38 ... ok 10/39 ... ok 18/40 ... ok 10/41 ... ok 15/42 ... ok 10/43 ... ok 15/44 ... ok 18/45 ... ok 15/46 ... ok 10/47 ... ok 10/48 ... ok 10/49 ... ok 17/50 ... ok 10/51 ... ok 17/52 ... ok 18/53 ... ok 9/54 ... ok 10/55 ... ok 15/56 ... ok 10/57 ... ok 20/58 ... ok 10/59 ... ok 15/60 ... ok 10/61 ... ok 15/62 ... ok 10/64 ... ok 10/65 ... ok 10/66 ... ok 21/67 ... ok 10/68 ... ok 10/69 ... ok 21/70 ... ok 18/71 ... ok 10/72 ... ok 15/73 ... ok 10/74 ... ok 10/75 ... ok 10/76 ... ok 10/77 ... ok 10/78 ... ok 10/79 ... ok 17/80 ... ok 10/81 ... ok 10/83 ... ok 18/84 ... ok 10/85 ... ok 17/86 ... ok 10/87 ... ok 10/88 ... ok 22/89 ... ok 10/90 ... ok 10/91 ... ok 22/92 ... ok 22/93 ... ok 22/94 ... ok 15/95 ... ok 15/96 ... ok 10/97 ... ok 18/98 ... ok 15/99 ... ok 17/100 ... ok 15/101 ... ok 18/102 ... ok 15/103 ... ok 18/104 ... ok 18/105 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

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

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml Checking LDAP ...

LDAP is disabled in config/gitlab.yml

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: ... 10/4 ... yes 10/5 ... yes 10/6 ... yes 10/8 ... yes 10/9 ... yes 10/10 ... yes 10/12 ... yes 10/13 ... yes 15/14 ... yes 15/15 ... yes 15/16 ... yes 15/17 ... yes 10/18 ... yes 16/19 ... yes 10/21 ... yes 10/22 ... yes 10/26 ... yes 10/27 ... yes 10/28 ... yes 10/29 ... yes 10/30 ... yes 10/31 ... yes 10/32 ... yes 9/34 ... yes 15/35 ... yes 10/36 ... yes 18/37 ... yes 18/38 ... yes 10/39 ... yes 18/40 ... yes 10/41 ... yes 15/42 ... yes 10/43 ... yes 15/44 ... yes 18/45 ... yes 15/46 ... yes 10/47 ... yes 10/48 ... yes 10/49 ... yes 17/50 ... yes 10/51 ... yes 17/52 ... yes 18/53 ... yes 9/54 ... yes 10/55 ... yes 15/56 ... yes 10/57 ... yes 20/58 ... yes 10/59 ... yes 15/60 ... yes 10/61 ... yes 15/62 ... yes 10/64 ... yes 10/65 ... yes 10/66 ... yes 21/67 ... yes 10/68 ... yes 10/69 ... yes 21/70 ... yes 18/71 ... yes 10/72 ... yes 15/73 ... yes 10/74 ... yes 10/75 ... yes 10/76 ... yes 10/77 ... yes 10/78 ... yes 10/79 ... yes 17/80 ... yes 10/81 ... yes 10/83 ... yes 18/84 ... yes 10/85 ... yes 17/86 ... yes 10/87 ... yes 10/88 ... yes 22/89 ... yes 10/90 ... yes 10/91 ... yes 22/92 ... yes 22/93 ... yes 22/94 ... yes 15/95 ... yes 15/96 ... yes 10/97 ... yes 18/98 ... yes 15/99 ... yes 17/100 ... yes 15/101 ... yes 18/102 ... yes 15/103 ... yes 18/104 ... yes 18/105 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.4) Git version >= 2.9.5 ? ... yes (2.17.1) Git user has default SSH configuration? ... yes Active users: ... 5

Checking GitLab ... Finished