• gitlab 16.x - ERR unknown command ‘HELLO‘


    现象

    gitlab部分操作报错500。通过Rails日志发现以下报错:

    报错:

    RedisClient::CommandError

    ERR unknown command 'HELLO'

    1. {
    2. "severity": "ERROR",
    3. "time": "2024-04-22T02:50:16.906Z",
    4. "correlation_id": "01HW1VC67EJEGKQ1A1CW9TMVPV",
    5. "meta.caller_id": "UserSettings::PersonalAccessTokensController#create",
    6. "meta.remote_ip": "10.1.11.11",
    7. "meta.feature_category": "system_access",
    8. "meta.user": "root",
    9. "meta.user_id": 1,
    10. "meta.client_id": "user/1",
    11. "exception.class": "RedisClient::CommandError",
    12. "exception.message": "ERR unknown command 'HELLO'",
    13. "exception.backtrace": [
    14. "lib/gitlab/instrumentation/redis_client_middleware.rb:26:in `block in call_pipelined'",
    15. "lib/gitlab/instrumentation/redis_helper.rb:17:in `instrument_call'",
    16. "lib/gitlab/instrumentation/redis_client_middleware.rb:25:in `call_pipelined'",
    17. "lib/gitlab/patch/redis_client.rb:12:in `ensure_connected'",
    18. "config/initializers/forbid_sidekiq_in_transactions.rb:82:in `block (2 levels) in \u003cmodule:NoEnqueueingFromTransactions\u003e'",
    19. "app/services/notification_service.rb:95:in `access_token_created'",
    20. "app/services/personal_access_tokens/create_service.rb:20:in `execute'",
    21. "app/controllers/user_settings/personal_access_tokens_controller.rb:33:in `create'",
    22. "app/controllers/application_controller.rb:468:in `set_current_admin'",
    23. "lib/gitlab/session.rb:11:in `with_session'",
    24. "app/controllers/application_controller.rb:459:in `set_session_storage'",
    25. "lib/gitlab/i18n.rb:114:in `with_locale'",
    26. "lib/gitlab/i18n.rb:120:in `with_user_locale'",
    27. "app/controllers/application_controller.rb:450:in `set_locale'",
    28. "app/controllers/application_controller.rb:443:in `set_current_context'",
    29. "lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'",
    30. "lib/gitlab/middleware/memory_report.rb:13:in `call'",
    31. "lib/gitlab/middleware/speedscope.rb:13:in `call'",
    32. "lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'",
    33. "lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'",
    34. "lib/gitlab/etag_caching/middleware.rb:21:in `call'",
    35. "lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'",
    36. "lib/gitlab/metrics/web_transaction.rb:46:in `run'",
    37. "lib/gitlab/metrics/rack_middleware.rb:16:in `call'",
    38. "lib/gitlab/middleware/go.rb:20:in `call'",
    39. "lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'",
    40. "lib/gitlab/database/query_analyzer.rb:40:in `within'",
    41. "lib/gitlab/middleware/query_analyzer.rb:11:in `call'",
    42. "lib/gitlab/middleware/multipart.rb:173:in `call'",
    43. "lib/gitlab/middleware/read_only/controller.rb:50:in `call'",
    44. "lib/gitlab/middleware/read_only.rb:18:in `call'",
    45. "lib/gitlab/middleware/unauthenticated_session_expiry.rb:18:in `call'",
    46. "lib/gitlab/middleware/same_site_cookies.rb:27:in `call'",
    47. "lib/gitlab/middleware/path_traversal_check.rb:35:in `call'",
    48. "lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'",
    49. "lib/gitlab/middleware/basic_health_check.rb:25:in `call'",
    50. "lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'",
    51. "lib/gitlab/middleware/request_context.rb:15:in `call'",
    52. "lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'",
    53. "config/initializers/fix_local_cache_middleware.rb:11:in `call'",
    54. "lib/gitlab/middleware/compressed_json.rb:44:in `call'",
    55. "lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'",
    56. "lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'",
    57. "lib/gitlab/metrics/requests_rack_middleware.rb:79:in `call'",
    58. "lib/gitlab/middleware/release_env.rb:13:in `call'"
    59. ],
    60. "user.username": "root",
    61. "tags.program": "web",
    62. "tags.locale": "en",
    63. "tags.feature_category": "system_access",
    64. "tags.correlation_id": "01HW1VC67EJEGKQ1A1CW9TMVPV",
    65. "extra.storage": "queues"
    66. }

    排查

    日志报错是Redis执行HELLO命令报错,这个命令适用于指定RESP版本。

    1. Gitlab官方文档要求16.0以上版本,需要使用Redis 6.x or 7.x
    2. Redis 6.x 开始支持RESP3
    3. 连接到Redis,执行Hello 2成功;执行Hello 3报错:ERR unknown command 'HELLO'

    结合以上3点,怀疑Gitlab 16.x版本之前使用RESP2,之后使用RESP3。

    进入Redis,执行monitor,复现问题查看操作:

    再次看到与HELLO 3命令相关。

    结论&后续处理

    结论(踩坑)

    1. 部分公有云Redis 6.x版本,不支持RESP3协议。
    2. Gitlab官方虽然明确说明16.x要使用Redis 6.x or 7.x,但是没有阐述原因。我想其中一个原因就是新的ruby代码对于RESP3协议的依赖。如果官网明确说明,并且附上前置检查步骤会更好。

    后续处理

    1. 可以自己部署6.x版本redis高可用节点。
    2. 可以选择支持RESP3协议的公有云Redis实例使用。
  • 相关阅读:
    打包vue前端docker镜像
    Kubernetes: client-go 源码剖析(一)
    3、字符设备驱动框架和开发步骤
    AbstractControllerUrlHandlerMapping类简介说明
    Modelsim测试覆盖率操作说明
    370万欧元!西班牙iPronics加速可重构光子芯片商用
    电脑文档数据恢复?别急,一招教你快速找回丢失数据!
    Java算法 每日一题(六) 编号203:移除链表元素
    为什么Adam 不是默认的优化算法?
    从入门到出师,关于学习RPA的建议!
  • 原文地址:https://blog.csdn.net/qq522044637/article/details/138085919