Sidekiq deploy fails - Redis max number of clients reached

Background

I’m trying to get a Sidekiq service running alongside my Rails app.

Problem

The Dashboard indicates that the deploy failed, but in the logs I can see it is trying to run jobs (so the Sidekiq service is able to “see” my classes in Rails):

... class=ObscuredJob jid=f75331bde1707476951f1622 elapsed=0.003 INFO: fail
... WARN: {"context":"Job raised exception","job":{"retry":true,"queue":"default","class":"ObscuredJob","args":[],"jid":"f75331bde1707476951f1622","created_at":1649253557.791971,"enqueued_at":1649253581.3656337,"error_message":"ERR max number of clients reached","error_class":"Redis::CommandError","failed_at":1649253557.7921286,"retry_count":0},"jobstr":"{\"retry\":true,\"queue\":\"default\",\"class\":\"ObscuredJob\",\"args\":[],\"jid\":\"f75331bde1707476951f1622\",\"created_at\":1649253557.791971,\"enqueued_at\":1649253581.3656337,\"error_message\":\"ERR max number of clients reached\",\"error_class\":\"Redis::CommandError\",\"failed_at\":1649253557.7921286,\"retry_count\":0}"}
... WARN: Redis::CommandError: ERR max number of clients reached
... WARN: /opt/render/project/.gems/ruby/3.1.0/gems/redis-4.6.0/lib/redis/client.rb:162:in `call'

The error Redis::CommandError: ERR max number of clients reached seems to indicate that my Redis settings here on Render are to blame. Can one not spin up a Rails app with Sidekiq using only free plans? The Redis docs show a connection limit of 50 for the free plan, and I don’t understand how I could have reached that limit already. Redis | Render · Cloud Hosting for Developers. Could someone advise if perhaps there are configurations to change in my app, or on my Render account itself?

Addendum:

The logs go on to output:

... ERROR: heartbeat: Connection lost (ECONNRESET)
... ERROR: ERR max number of clients reached

This error ERROR: heartbeat: Connection lost (ECONNRESET) is probably the culprit for the deploy showing as “Failed”, correct? Like, the jobs keep trying and retrying, but they error on the Redis max clients reached until the service finally is like “I’ve had enough. I’m outta here.” :sweat_smile:

Hello, Sidekiq needs to be deployed as Background Workers. However Render free plan is not available for background workers. Therefore deploying Sidekiq as web service will fail.

Thank you for that feedback. I mixed up the Web Service instruction in Step 3 with the Background Worker instruction in Step 2 from Deploy a Sidekiq Worker | Render.

I’ve since created the Background Worker; and added the REDIS_URL and SECRET_KEY_BASE env vars. Looks like it’s working nicely. :sparkles:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.