11.0.2 to 11.7.6, error viewing file blob, syntax error at or near "NULL"

Summary

Upgrading from 11.0.2-ee to 11.7.6-ee causes some pages to have 500 error.

Steps to reproduce

Upgrade from 11.0.2 to 11.7.6, navigate to a project/repository and view a file. You will get a 500 error page.

I noticed it happens when creating a merge request as well.

Relevant logs and/or screenshots

It seems to happen on any page that is using ee/app/views/projects/blob/_owners.html.haml.

Processing by Projects::BlobController#show as HTML
  Parameters: {"namespace_id"=>"docgen", "project_id"=>"sandbox", "id"=>"master/pages/index.md"}
Completed 500 Internal Server Error in 166ms (ActiveRecord: 9.3ms | Elasticsearch: 0.0ms)
  
ActionView::Template::Error (PG::SyntaxError: ERROR:  syntax error at or near "NULL"
LINE 1: SELECT COUNT(*) FROM (NULL) users INNER JOIN "project_author...
                              ^
: SELECT COUNT(*) FROM (NULL) users INNER JOIN "project_authorizations" ON "users"."id" = "project_authorizations"."user_id" WHERE "project_authorizations"."project_id" = 13):
    1: - return if blob.owners.empty?
    2: 
    3: .well-segment.blob-auxiliary-viewer.file-owner-content.qa-file-owner-content
    4:   = sprite_icon('users', size: 18, css_class: 'icon')
  
ee/app/views/projects/blob/_owners.html.haml:1:in `_ee_app_views_projects_blob__owners_html_haml__3160338644444957987_70327060385100'
app/helpers/application_helper.rb:10:in `render_if_exists'
app/views/projects/blob/_blob.html.haml:8:in `_app_views_projects_blob__blob_html_haml___1868327333262801625_70327084003440'
app/views/projects/blob/show.html.haml:13:in `_app_views_projects_blob_show_html_haml___3337019048549164682_70327085790240'
app/controllers/application_controller.rb:113:in `render'
app/controllers/projects/blob_controller.rb:249:in `show_html'
app/controllers/projects/blob_controller.rb:43:in `block (2 levels) in show'
app/controllers/projects/blob_controller.rb:41:in `show'
lib/gitlab/i18n.rb:55:in `with_locale'
lib/gitlab/i18n.rb:61:in `with_user_locale'
app/controllers/application_controller.rb:417:in `set_locale'
lib/gitlab/middleware/multipart.rb:103:in `call'
lib/gitlab/request_profiler/middleware.rb:16:in `call'
ee/lib/gitlab/jira/middleware.rb:15:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:13:in `call'
lib/gitlab/middleware/correlation_id.rb:16:in `block in call'
lib/gitlab/correlation_id.rb:15:in `use_id'
lib/gitlab/middleware/correlation_id.rb:15:in `call'
lib/gitlab/middleware/read_only/controller.rb:42:in `call'
lib/gitlab/middleware/read_only.rb:18: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:29:in `call'
lib/gitlab/middleware/release_env.rb:13:in `call'

Output of checks

NOTE: I'm sorry for the confusion at the moment, but these checks are AFTER I reverted back to 11.0.2. Our gitlab instance has to be up and running, I didn't have time to do all this. I will backup my data directory locally and try an upgrade shortly.

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Proxy: no 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-ee Revision: 7b39c13 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.8 URL: https://lab.medxchange.com HTTP Clone URL: https://lab.medxchange.com/some-group/some-project.git SSH Clone URL: git@lab.medxchange.com:some-group/some-project.git Elasticsearch: no Geo: no 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: ... 3/1 ... ok 3/2 ... ok 1/4 ... ok 5/5 ... ok 1/6 ... ok 3/7 ... ok 8/8 ... ok 9/9 ... ok 1/10 ... ok 3/12 ... repository is empty 9/13 ... ok 11/14 ... ok 12/15 ... ok 12/16 ... repository is empty 13/17 ... repository is empty 9/18 ... ok 12/20 ... ok 12/21 ... ok 12/22 ... ok 22/24 ... ok 12/25 ... ok 12/27 ... ok 23/28 ... repository is empty 25/29 ... ok 12/30 ... ok 12/31 ... 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: ... 3/1 ... yes 3/2 ... yes 1/4 ... yes 5/5 ... yes 1/6 ... yes 3/7 ... yes 8/8 ... yes 9/9 ... yes 1/10 ... yes 3/12 ... yes 9/13 ... yes 11/14 ... yes 12/15 ... yes 12/16 ... yes 13/17 ... yes 9/18 ... yes 12/20 ... yes 12/21 ... yes 12/22 ... yes 22/24 ... yes 12/25 ... yes 12/27 ... yes 23/28 ... yes 25/29 ... yes 12/30 ... yes 12/31 ... 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: ... 8 Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)

Checking GitLab ... Finished

Possible fixes

Edited by Paul Knopf