gitlab点击项目 报500错误解决方案

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gitlab点击项目 报500错误解决方案相关的知识,希望对你有一定的参考价值。

参考技术A gitlab issues
https://gitlab.com/gitlab-org/gitlab-foss/-/issues/17873

解决方案
是gitlab数据迁移时的一个缺陷。解决方法:
1、覆盖原来gitlab的 db_key_base 到新的gitlab
db_key_base 位置在 /etc/gitlab/gitlab-secrets.json
2、EE版本执行
sudo gitlab-rails runner "Project.where(mirror: false).where.not(import_url: nil).each |p| p.import_data.destroy if p.import_data "
CE版本执行
sudo gitlab-rails runner "Project.where.not(import_url: nil).each |p| p.import_data.destroy if p.import_data "

gitlab 将公有项目改为私有项目失败

gitlab 将公有项目改为私有项目失败

报错内容:改项目属性失败,报500错误 “Whoops, something went wrong on our end.”

  1. 查找日志
    查找/var/log/gitlab/gitlab-rails/production.log ,对比执行过程,发现报错对应如下日志:
    OpenSSL::Cipher::CipherError ():

官方推荐这个命令 gitlab-ctl tail gitlab-rails

Started GET "/-/metrics" for 127.0.0.1 at 2020-06-18 10:11:59 +0800
Processing by MetricsController#index as HTML
Completed 200 OK in 35ms (Views: 0.5ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)
Started DELETE "/core/maxno" for 58.246.24.194 at 2020-06-18 10:12:03 +0800
Processing by ProjectsController#destroy as HTML
  Parameters: {"authenticity_token"=>"[FILTERED]", "namespace_id"=>"core", "id"=>"maxno"}
Completed 500 Internal Server Error in 24ms (ActiveRecord: 2.9ms | Elasticsearch: 0.0ms)
  
OpenSSL::Cipher::CipherError ():
  
lib/gitlab/crypto_helper.rb:27:in `aes256_gcm_decrypt'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:45:in `get_token'
app/models/concerns/token_authenticatable_strategies/base.rb:27:in `ensure_token'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:32:in `ensure_token'
app/models/concerns/token_authenticatable.rb:40:in `block in add_authentication_token_field'
app/services/projects/destroy_service.rb:13:in `async_execute'
lib/gitlab/metrics/instrumentation.rb:161:in `block in async_execute'
lib/gitlab/metrics/method_call.rb:36:in `measure'
lib/gitlab/metrics/instrumentation.rb:161:in `async_execute'
app/controllers/projects_controller.rb:149:in `destroy'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
ee/app/controllers/ee/application_controller.rb:28:in `set_current_ip_address'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:445:in `set_session_storage'
lib/gitlab/i18n.rb:55:in `with_locale'
lib/gitlab/i18n.rb:61:in `with_user_locale'
app/controllers/application_controller.rb:439:in `set_locale'
lib/gitlab/middleware/rails_queue_duration.rb:27:in `call'
lib/gitlab/metrics/rack_middleware.rb:17:in `block in call'
lib/gitlab/metrics/transaction.rb:57:in `run'
lib/gitlab/metrics/rack_middleware.rb:17:in `call'
lib/gitlab/middleware/multipart.rb:103:in `call'
lib/gitlab/request_profiler/middleware.rb:16:in `call'
ee/lib/gitlab/jira/middleware.rb:17: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/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:26:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:29:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'
  1. google 解决办法。相信我,大部分的问题别人都碰到过。
    https://gitlab.com/gitlab-org/gitlab-foss/-/issues/66002
    https://gitlab.com/gitlab-org/gitlab-foss/-/issues/59413
    https://docs.gitlab.com/ee/raketasks/backup_restore.html#when-the-secrets-file-is-lost
进入DB控制台
[root@VM_1_17_centos ~]# gitlab-rails dbconsole
psql (10.7)
Type "help" for help.

# update 后面数字是项目id
gitlabhq_production=> UPDATE projects SET runners_token = null, runners_token_encrypted = null;
UPDATE 16
gitlabhq_production=> UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
UPDATE 33
gitlabhq_production=> UPDATE application_settings SET runners_registration_token_encrypted = null;
UPDATE 1
gitlabhq_production=> UPDATE ci_runners SET token = null, token_encrypted = null;
UPDATE 0

  1. 执行完后,都不用重启服务,立马见效


    点击保存即可

删除项目可参考https://www.jianshu.com/p/768809e8e542

以上是关于gitlab点击项目 报500错误解决方案的主要内容,如果未能解决你的问题,请参考以下文章

GitLab-500问题解决办法

断电后gitlab报500错误启动出错

GitLab合并请求报错

Gitlab其他用户登录返回500错误解决

gitlab 500 服务器错误 重启解决了

gitlab 将公有项目改为私有项目失败