Skip to content

Downgrade redis-rb gem to v5.4.0

What does this MR do and why?

In https://github.com/redis/redis-rb/pull/1312, redis v5.4.1 was updated to translate RedisClient::ConnectionError to Redis::ConnectionError to avoid leaking the underlying exception. However, ActionCable v7.1.5.2 relied on this behavior and only reconnected if RedisClient::ConnectionError were raised. As a result, if the Redis server terminated an idle connection, the Puma thread would raise an exception and cause the worker process to restart.

Rails has since been updated to handle this in https://github.com/rails/rails/pull/55359. The fix has been committed to the Rails 7-1-stable branch but not yet released.

References

Relates to https://gitlab.com/gitlab-com/request-for-help/-/issues/3593

How to set up and validate locally

  1. Access a merge request in your GDK.
  2. gdk tail rails-web
  3. gdk restart redis

You should see no messages about threads terminating:

2025-10-16_20:39:30.73170 rails-web               : {"timestamp":"2025-10-16T20:39:30.731Z","pid":95489,"message":"- Worker 1 (PID: 95727) booted in 0.2s, phase: 0"}
2025-10-16_20:39:30.73369 rails-web               : {"timestamp":"2025-10-16T20:39:30.732Z","pid":95489,"message":"- Worker 0 (PID: 95726) booted in 0.21s, phase: 0"}
2025-10-16_20:42:10.96164 rails-web               : DEPRECATION WARNING: using BatchLoader.for in GraphQL is deprecated. Use BatchLoader::GraphQL.for instead or return BatchLoader::GraphQL.wrap from your resolver.

If you try the same thing on master, you will see:

2025-10-16_20:44:32.39276 rails-web               : #<Thread:0x0000000341559f80 /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/actioncable-7.1.5.2/lib/action_cable/subscription_adapter/redis.rb:158 run> terminated with exception (report_on_exception is true):
2025-10-16_20:44:32.39278 rails-web               : /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client/ruby_connection.rb:104:in `rescue in read': EOFError (unix:///Users/stanhu/gitlab/gdk-ee/redis/redis.socket) (Redis::ConnectionError)
2025-10-16_20:44:32.39279 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client/ruby_connection.rb:95:in `read'
2025-10-16_20:44:32.39279 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client.rb:573:in `next_event'
2025-10-16_20:44:32.39281 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/subscribe.rb:66:in `subscription'
2025-10-16_20:44:32.39281 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/subscribe.rb:17:in `subscribe'
2025-10-16_20:44:32.39282 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis.rb:177:in `_subscription'
2025-10-16_20:44:32.39282 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/commands/pubsub.rb:17:in `subscribe'
2025-10-16_20:44:32.39283 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/actioncable-7.1.5.2/lib/action_cable/subscription_adapter/redis.rb:90:in `block in listen'
2025-10-16_20:44:32.39283 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client.rb:788:in `ensure_connected'
2025-10-16_20:44:32.39284 rails-web               : 	from /Users/stanhu/gitlab/gdk-ee/gitlab/lib/gitlab/patch/redis_client.rb:12:in `ensure_connected'
2025-10-16_20:44:32.39284 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/client.rb:91:in `ensure_connected'
2025-10-16_20:44:32.39285 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client.rb:481:in `disable_reconnection'
2025-10-16_20:44:32.39285 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis.rb:81:in `without_reconnect'
2025-10-16_20:44:32.39286 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/actioncable-7.1.5.2/lib/action_cable/subscription_adapter/redis.rb:87:in `listen'
2025-10-16_20:44:32.39286 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/actioncable-7.1.5.2/lib/action_cable/subscription_adapter/redis.rb:163:in `block in ensure_listener_running'
2025-10-16_20:44:32.39286 rails-web               : /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client/ruby_connection.rb:104:in `rescue in read': EOFError (unix:///Users/stanhu/gitlab/gdk-ee/redis/redis.socket) (RedisClient::ConnectionError)
2025-10-16_20:44:32.39287 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client/ruby_connection.rb:95:in `read'
2025-10-16_20:44:32.39287 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client.rb:573:in `next_event'
2025-10-16_20:44:32.39288 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/subscribe.rb:66:in `subscription'
2025-10-16_20:44:32.39288 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/subscribe.rb:17:in `subscribe'
2025-10-16_20:44:32.39288 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis.rb:177:in `_subscription'
2025-10-16_20:44:32.39288 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/commands/pubsub.rb:17:in `subscribe'
2025-10-16_20:44:32.39289 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/actioncable-7.1.5.2/lib/action_cable/subscription_adapter/redis.rb:90:in `block in listen'
2025-10-16_20:44:32.39289 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client.rb:788:in `ensure_connected'
2025-10-16_20:44:32.39291 rails-web               : 	from /Users/stanhu/gitlab/gdk-ee/gitlab/lib/gitlab/patch/redis_client.rb:12:in `ensure_connected'
2025-10-16_20:44:32.39291 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis/client.rb:91:in `ensure_connected'
2025-10-16_20:44:32.39292 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-client-0.26.1/lib/redis_client.rb:481:in `disable_reconnection'
2025-10-16_20:44:32.39292 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/redis-5.4.1/lib/redis.rb:81:in `without_reconnect'
2025-10-16_20:44:32.39293 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/actioncable-7.1.5.2/lib/action_cable/subscription_adapter/redis.rb:87:in `listen'
2025-10-16_20:44:32.39293 rails-web               : 	from /Users/stanhu/.local/share/mise/installs/ruby/3.3.9/lib/ruby/gems/3.3.0/gems/actioncable-7.1.5.2/lib/action_cable/subscription_adapter/redis.rb:163:in `block in ensure_listener_running'
2025-10-16_20:44:32.39293 rails-we

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports

Loading