500 Internal Server Error: Getting commits of a deleted project
Summary
500 Internal Server Error: Getting commits of a deleted project
Steps to reproduce
- Create project
- Delete project
- Get project's commmits
Sample curl:
curl -v -X 'POST' -H "Content-Type: application/json" -H 'PRIVATE-TOKEN: juDvZNgjFyzz_pByLW8W' 'http://127.0.0.1/api/v4/projects' -d '{"name":"3ee135p10abp10a"}' ; curl -v -X 'DELETE' -H "Content-Type: application/json" -H 'PRIVATE-TOKEN: juDvZNgjFyzz_pByLW8W' 'http://127.0.0.1/api/v4/projects/130737' ; curl -v -X 'GET' 'http://127.0.0.1/api/v4/projects/130737/repository/commits' -H "Content-Type: application/json" -H 'PRIVATE-TOKEN: juDvZNgjFyzz_pByLW8W'
Example Project
Bug is reproducible in a local deployment, source code installation of EE on 11-2-stable branch.
What is the current bug behavior?
500 Internal Server Error
What is the expected correct behavior?
Some 40x error message.
Relevant logs and/or screenshots
Gitlab::Git::Repository::NoRepository (5:GetRepoPath: not a git repository '/home/git/repositories/vatlidak1/3ee135p10abp10a.git'):
/home/git/gitlab/lib/gitlab/git/repository.rb:1002:in `rescue in wrapped_gitaly_errors'
/home/git/gitlab/lib/gitlab/git/repository.rb:1000:in `wrapped_gitaly_errors'
/home/git/gitlab/lib/gitlab/git/repository.rb:363:in `log'
/home/git/gitlab/lib/gitlab/git/commit.rb:41:in `where'
/home/git/gitlab/app/models/repository.rb:145:in `commits'
/home/git/gitlab/lib/api/commits.rb:46:in `block (2 levels) in <class:Commits>'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:57:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:57:in `block (2 levels) in generate_api_method'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:166:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:56:in `block in generate_api_method'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:262:in `block in run'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:166:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:243:in `run'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:313:in `block in build_stack'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/base.rb:31:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/base.rb:24:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/base.rb:31:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/base.rb:24:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-oauth2-1.2.3/lib/rack/oauth2/server/resource.rb:20:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-oauth2-1.2.3/lib/rack/oauth2/server/resource/bearer.rb:8:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/error.rb:37:in `block in call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/error.rb:36:in `catch'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/error.rb:36:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/base.rb:24:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape_logging-1.7.0/lib/grape_logging/middleware/request_logger.rb:60:in `block in call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape_logging-1.7.0/lib/grape_logging/middleware/request_logger.rb:58:in `catch'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape_logging-1.7.0/lib/grape_logging/middleware/request_logger.rb:58:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/middleware/base.rb:24:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/head.rb:13:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:227:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/endpoint.rb:221:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router/route.rb:72:in `exec'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router.rb:121:in `process_route'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router.rb:74:in `block in identity'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router.rb:93:in `transaction'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router.rb:72:in `identity'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router.rb:57:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router.rb:137:in `with_optimization'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/router.rb:56:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/api.rb:119:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/api.rb:45:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/grape-1.0.3/lib/grape/api.rb:40:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/routing/mapper.rb:51:in `serve'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/journey/router.rb:43:in `block in serve'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/journey/router.rb:30:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/journey/router.rb:30:in `serve'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/routing/route_set.rb:817:in `call'
/home/git/gitlab/lib/gitlab/middleware/multipart.rb:97:in `call'
/home/git/gitlab/lib/gitlab/request_profiler/middleware.rb:14:in `call'
/home/git/gitlab/lib/gitlab/middleware/go.rb:17:in `call'
/home/git/gitlab/lib/gitlab/etag_caching/middleware.rb:11:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/batch-loader-1.2.1/lib/batch_loader/middleware.rb:11:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-attack-4.4.1/lib/rack/attack.rb:107:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-cors-1.0.2/lib/rack/cors.rb:97:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/etag.rb:24:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/conditionalget.rb:25:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/head.rb:13:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/home/git/gitlab/lib/gitlab/middleware/read_only/controller.rb:38:in `call'
/home/git/gitlab/lib/gitlab/middleware/read_only.rb:16:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/flash.rb:260:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/session/abstract/id.rb:225:in `context'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/session/abstract/id.rb:220:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/query_cache.rb:36:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/home/git/gitlab/lib/gitlab/middleware/basic_health_check.rb:25:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/rack/logger.rb:38:in `call_app'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/rack/logger.rb:20:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:26:in `tagged'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:68:in `tagged'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/rack/logger.rb:20:in `call'
/home/git/gitlab/lib/gitlab/request_context.rb:18:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/request_store-1.3.1/lib/request_store/middleware.rb:9:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/methodoverride.rb:22:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/runtime.rb:18:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/lock.rb:17:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/sendfile.rb:113:in `call'
/home/git/gitlab/lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/sentry-raven-2.7.2/lib/raven/integrations/rack.rb:51:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/engine.rb:518:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/application.rb:165:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/railtie.rb:194:in `public_send'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/railtie.rb:194:in `method_missing'
/home/git/gitlab/lib/gitlab/middleware/release_env.rb:10:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/urlmap.rb:66:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/urlmap.rb:50:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rack-1.6.10/lib/rack/urlmap.rb:50:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:562:in `process_client'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-worker-killer-0.4.4/lib/unicorn/worker_killer.rb:52:in `process_client'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:658:in `worker_loop'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:132:in `start'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/bin/unicorn_rails:209:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/bin/unicorn_rails:22:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/bin/unicorn_rails:22:in `<top (required)>'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `load'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/cli.rb:424:in `exec'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/cli.rb:27:in `dispatch'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/cli.rb:18:in `start'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
==> /home/git/gitlab/log/api_json.log <==
{"time":"2018-09-03T03:24:55.917Z","severity":"INFO","duration":48.79,"db":3.03,"view":45.76,"status":500,"method":"GET","path":"/api/v4/projects/130737/repository/commits","params":{},"host":"127.0.0.1","ip":"127.0.0.1","ua":"curl/7.47.0","user_id":2,"username":"vatlidak1","queue_duration":7.71}
==> /home/git/gitlab/log/gitlab-workhorse.log <==
127.0.0.1 @ - - [2018/09/03:03:24:55 +0000] "GET /api/v4/projects/130737/repository/commits HTTP/1.1" 500 39 "" "curl/7.47.0" 0.058
==> /home/git/gitlab/log/application.log <==
September 03, 2018 03:24: Project "vatlidak1/3ee135p10abp10a" was removed