Skip to content

Restart Action Cable server when Redis disconnects

Heinrich Lee Yu requested to merge 352250-fix-puma-crash-redis into master

What does this MR do and why?

Prevent Puma from crashing when there are connection errors to Redis. This change catches the error and restarts the Action Cable server when there are connection errors.

We need to restart Action Cable and disconnect all clients because once we reconnect to Redis, all the previous SUBSCRIBE commands we made are no longer applicable.

How to set up and validate locally

  1. Change cable.yml so that it connects to a different Redis server
  2. Start Puma and open an issue page (e.g. http://localhost:3000/group/project/-/issues/1). This is the only page right now that uses Action Cable.
  3. Stop / restart the Redis server

Without this change, Puma workers would crash. With this MR, it will just disconnect the Action Cable clients and then reconnect until Redis is up again. You will be able to continue to browse the web UI.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #352250 (closed)

Edited by Heinrich Lee Yu

Merge request reports