Internal error (Status 500) after change in project visibility.
Summary
After changing the visibility of a project to from private to public it cannot be accessed be anymore. A status 500 is returned.
Steps to reproduce
- User A creates a group X, which has 'internal' visibility
- User A adds user B to group X as Master
- User B creates new project P with visibility 'private'
- User A changes visibility to 'public'
What is the current bug behavior?
A Status 500 Error code is displayed.
What is the expected correct behavior?
Either:
- The change in visibility by User A is prohibited
- The project is displayed normally.
Relevant logs and/or screenshots
From the production.log:
Started GET "/ail/ail-r10k-rest" for 141.22.41.6 at 2017-09-13 12:08:16 +0200
Processing by ProjectsController#show as HTML
Parameters: {"namespace_id"=>"ail", "id"=>"ail-r10k-rest"}
Completed 500 Internal Server Error in 66ms (ActiveRecord: 3.7ms | Elasticsearch: 0.0ms)
NoMethodError (undefined method `access_level' for nil:NilClass):
app/policies/project_policy.rb:339:in `feature_available?'
app/policies/project_policy.rb:78:in `block (2 levels) in <class:ProjectPolicy>'
lib/declarative_policy/condition.rb:21:in `instance_eval'
lib/declarative_policy/condition.rb:21:in `compute'
lib/declarative_policy/condition.rb:42:in `block in pass?'
lib/declarative_policy/base.rb:279:in `cache'
lib/declarative_policy/condition.rb:42:in `pass?'
lib/declarative_policy/rule.rb:79:in `pass?'
lib/declarative_policy/step.rb:79:in `pass?'
lib/declarative_policy/runner.rb:97:in `block in run'
lib/declarative_policy/runner.rb:167:in `block in steps_by_score'
lib/declarative_policy/runner.rb:145:in `loop'
lib/declarative_policy/runner.rb:145:in `steps_by_score'
lib/declarative_policy/runner.rb:78:in `run'
lib/declarative_policy/runner.rb:56:in `pass?'
lib/declarative_policy/base.rb:215:in `block in allowed?'
lib/declarative_policy/base.rb:215:in `each'
lib/declarative_policy/base.rb:215:in `all?'
lib/declarative_policy/base.rb:215:in `allowed?'
lib/declarative_policy/base.rb:207:in `can?'
app/models/ability.rb:48:in `allowed?'
lib/gitlab/metrics/instrumentation.rb:156:in `block in allowed?'
lib/gitlab/metrics/method_call.rb:23:in `measure'
lib/gitlab/metrics/instrumentation.rb:156:in `allowed?'
app/controllers/application_controller.rb:141:in `can?'
app/controllers/projects_controller.rb:278:in `render_landing_page'
app/controllers/projects_controller.rb:111:in `block (2 levels) in show'
app/controllers/projects_controller.rb:108:in `show'
lib/gitlab/i18n.rb:46:in `with_locale'
lib/gitlab/i18n.rb:52:in `with_user_locale'
app/controllers/application_controller.rb:334:in `set_locale'
lib/gitlab/middleware/multipart.rb:93: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/rails_queue_duration.rb:20:in `call'
lib/gitlab/metrics/rack_middleware.rb:29:in `block in call'
lib/gitlab/metrics/transaction.rb:49:in `run'
lib/gitlab/metrics/rack_middleware.rb:29:in `call'
lib/gitlab/middleware/readonly_geo.rb:30:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
System information
System: Ubuntu 16.04
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: 12.0.0
Redis Version: 3.2.5
Git Version: 2.13.5
Sidekiq Version:5.0.4
Go Version: unknown
GitLab information
Version: 9.5.4-ee
Revision: 08803f6
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.3
URL: https://gitlab.informatik.haw-hamburg.de
HTTP Clone URL: https://gitlab.informatik.haw-hamburg.de/some-group/some-project.git
SSH Clone URL: git@gitlab.informatik.haw-hamburg.de:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 5.8.0
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
Checking GitLab Shell ...
GitLab Shell version >= 5.8.0 ? ... OK (5.8.0)
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: ...
8/1 ... ok
8/2 ... ok
8/4 ... ok
8/5 ... ok
8/7 ... ok
8/8 ... ok
8/9 ... ok
8/10 ... ok
8/11 ... ok
12/12 ... repository is empty
<...500+ repositories skipped. Some more are empty...>
656/666 ... ok
656/667 ... ok
73/668 ... 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
not verifying SSL hostname of LDAPS server 'dir-read.informatik.haw-hamburg.de:389'
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
Checking LDAP ... Finished
< ...100 valid LDAP accounts removed... >
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? ... no
Try fixing it:
sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads
sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
For more information see:
doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
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: ...
8/1 ... yes
8/2 ... yes
8/4 ... yes
< ...500+ more Projects with Namespace skipped... >
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.3 ? ... yes (2.3.3)
Git version >= 2.7.3 ? ... yes (2.13.5)
Active users: ... 318
Elasticsearch version 5.1 - 5.3? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished