问题描述
在对 gitlab 进行项目修改保存时候,出现了 500 错误,经查看日志,发现 OpenSSL::Cipher::CipherError
异常,如下图所示:
==> /var/log/gitlab/gitlab-rails/production.log <==OpenSSL::Cipher::CipherError ():lib/gitlab/crypto_helper.rb:28:in `aes256_gcm_decrypt'
app/models/concerns/token_authenticatable_strategies/encryption_helper.rb:18:in `decrypt_token'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:78:in `get_encrypted_token'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:113:in `token_set?'
app/models/concerns/token_authenticatable_strategies/base.rb:44:in `ensure_token'
app/models/concerns/token_authenticatable_strategies/encrypted.rb:38:in `ensure_token'
app/models/concerns/token_authenticatable.rb:49:in `block in add_authentication_token_field'
lib/gitlab/database/load_balancing/connection_proxy.rb:121:in `public_send'
lib/gitlab/database/load_balancing/connection_proxy.rb:121:in `block in write_using_load_balancer'
lib/gitlab/database/load_balancing/load_balancer.rb:127:in `block in read_write'
lib/gitlab/database/load_balancing/load_balancer.rb:198:in `retry_with_backoff'
lib/gitlab/database/load_balancing/load_balancer.rb:116:in `read_write'
lib/gitlab/database/load_balancing/connection_proxy.rb:120:in `write_using_load_balancer'
lib/gitlab/database/load_balancing/connection_proxy.rb:72:in `transaction'
lib/gitlab/database/load_balancing/connection_proxy.rb:121:in `public_send'
lib/gitlab/database/load_balancing/connection_proxy.rb:121:in `block in write_using_load_balancer'
lib/gitlab/database/load_balancing/load_balancer.rb:127:in `block in read_write'
lib/gitlab/database/load_balancing/load_balancer.rb:198:in `retry_with_backoff'
lib/gitlab/database/load_balancing/load_balancer.rb:116:in `read_write'
lib/gitlab/database/load_balancing/connection_proxy.rb:120:in `write_using_load_balancer'
lib/gitlab/database/load_balancing/connection_proxy.rb:72:in `transaction'
app/services/projects/update_service.rb:34:in `execute'
app/controllers/projects_controller.rb:112:in `update'
app/controllers/application_controller.rb:524:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:515:in `set_session_storage'
lib/gitlab/i18n.rb:107:in `with_locale'
lib/gitlab/i18n.rb:113:in `with_user_locale'
app/controllers/application_controller.rb:506:in `set_locale'
app/controllers/application_controller.rb:499:in `set_current_context'
lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'
lib/gitlab/middleware/memory_report.rb:13:in `call'
lib/gitlab/middleware/speedscope.rb:13:in `call'
lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'
lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'
lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'
lib/gitlab/metrics/web_transaction.rb:46:in `run'
lib/gitlab/metrics/rack_middleware.rb:16:in `call'
lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:21:in `call'
lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'
lib/gitlab/database/query_analyzer.rb:37:in `within'
lib/gitlab/middleware/query_analyzer.rb:11:in `call'
lib/gitlab/middleware/multipart.rb:173:in `call'
lib/gitlab/middleware/read_only/controller.rb:50:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:21:in `call'
lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'
config/initializers/fix_local_cache_middleware.rb:11:in `call'
lib/gitlab/middleware/compressed_json.rb:37:in `call'
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'
lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:79:in `call'
lib/gitlab/middleware/release_env.rb:13:in `call'
解决方法
按照如下步骤重置Token。
进入 gitlab-psql 命令行,使用 UPDATE projects SET runners_token = null, runners_token_encrypted = null;
语句重置 Token
root@326adcd27dab:/# gitlab-psql -d gitlabhq_production
psql (13.8)
Type "help" for help.gitlabhq_production=# UPDATE projects SET runners_token = null, runners_token_encrypted = null;
UPDATE 695
然后回到浏览器操作,发现可以正常操作了,无需重启gitlab服务。
(END)